rest_prepare_post_type

rest_prepare_post_type

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.8.2

apply_filters('rest_prepare_post_type') is found 2 times:

  • /wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php line 189
     
    		// Don't prepare the response body for HEAD requests.
    		if ( $request->is_method( 'HEAD' ) ) {
    			/** This filter is documented in wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php */
    			return apply_filters( 'rest_prepare_post_type', new WP_REST_Response( array() ), $post_type, $request );
    		}
    
    		$taxonomies = wp_list_filter( get_object_taxonomies( $post_type->name, 'objects' ), array( 'show_in_rest' => true ) );
    		$taxonomies = wp_list_pluck( $taxonomies, 'name' );
    		$base       = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name;
    		$namespace  = ! empty( $post_type->rest_namespace ) ? $post_type->rest_namespace : 'wp/v2';
    
  • /wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php line 290
    		 * @param WP_REST_Response $response  The response object.
    		 * @param WP_Post_Type     $post_type The original post type object.
    		 * @param WP_REST_Request  $request   Request used to generate the response.
    		 */
    		return apply_filters( 'rest_prepare_post_type', $response, $post_type, $request );
    	}
    
    	/**
    	 * Prepares links for the request.
    	 *
    	 * @since 6.1.0
    

See this hook used in plugins: