do_action_ref_array( ‘the_post’, WP_Post $post, WP_Query $query )

Fires once the post data has been set up.

Parameters

$postWP_Post
The Post object (passed by reference).
$queryWP_Query
The current Query object (passed by reference).

More Information

The ‘the_post’ action hook allows developers to modify the post object immediately after being queried and setup.

The post object is passed to this hook by reference so there is no need to return a value.

Example

function my_the_post_action( $post_object ) {
// modify post object here
}
add_action( 'the_post', 'my_the_post_action' );

Source

do_action_ref_array( 'the_post', array( &$post, &$this ) );

Changelog

VersionDescription
4.1.0Introduced $query parameter.
2.8.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.