Filter hook 'rest_prepare_theme'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php at line 382

View Source

rest_prepare_theme

Filter Hook
Description
Filters theme data returned from the REST API.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php View on GitHub
Hook Type Filter
Line Number 382

Hook Parameters

Type Name Description
WP_REST_Response $response The response object.
WP_Theme $theme Theme object used to create response.
WP_REST_Request $request Request object.

Usage Examples

Basic Usage
<?php
// Hook into rest_prepare_theme
add_filter('rest_prepare_theme', 'my_custom_filter', 10, 3);

function my_custom_filter($response, $theme, $request) {
    // Your custom filtering logic here
    return $response;
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php:382 - How this hook is used in WordPress core
<?php
 377  		 *
 378  		 * @param WP_REST_Response $response The response object.
 379  		 * @param WP_Theme         $theme    Theme object used to create response.
 380  		 * @param WP_REST_Request  $request  Request object.
 381  		 */
 382  		return apply_filters( 'rest_prepare_theme', $response, $theme, $request );
 383  	}
 384  
 385  	/**
 386  	 * Prepares links for the request.
 387  	 *

PHP Documentation

<?php
/**
		 * Filters theme data returned from the REST API.
		 *
		 * @since 5.0.0
		 *
		 * @param WP_REST_Response $response The response object.
		 * @param WP_Theme         $theme    Theme object used to create response.
		 * @param WP_REST_Request  $request  Request object.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
Related Hooks

Related hooks will be displayed here in future updates.