Skip to content

rest_the_post

github-actions[bot] edited this page Jun 25, 2026 · 1 revision

Filter the post.

Allows plugins to filter the post object as returned by \WP_REST_Controller::get_post().

Auto-generated Example

add_filter(
   'rest_the_post',
    function(
        WP_Post $post_obj = null,
        int|WP_Post $post
    ) {
        // Your code here.
        return null;
    },
    10,
    2
);

Parameters

  • WP_Post|null $post_obj The post object as returned by get_post().
  • int|WP_Post $post The original value used to obtain the post object.

Files

apply_filters( 'rest_the_post', $post_obj, $post )

← All Hooks

Clone this wiki locally