a_z_listing_real_api_handler( WP_REST_Request $request, array $args )

Shared REST API handler


Description


Parameters

$request

(Required) The REST API Request.

$args

(Required) Extra parameters set in the entrypoint functions.


Source

File: wp-api/api.php

function a_z_listing_real_api_handler( WP_REST_Request $request, array $args ) {
	$output = a_z_shortcode_handler( $args );

	if ( $request->get_param( 'include-styles' ) ) {
		wp_enqueue_style( 'a-z-listing' );
		global $wp_styles;
		foreach ( $wp_styles->default_dirs as $key => $dir ) {
			if ( '/wp-includes/css/' === $dir ) {
				unset( $wp_styles->default_dirs[ $key ] );
			}
		}
		$wp_styles->do_concat = true;
		$wp_styles->do_items();
		$output = $wp_styles->print_html . $wp_styles->print_code . $output;
	}

	return array(
		'rendered' => $output,
	);
}

Changelog

Changelog
VersionDescription
1.0.0Introduced.