This page redirects to an external site: https://developer.wordpress.org/reference/hooks/posts_results/
function my_posts_results_filter( $posts ) {
$filtered_posts = array();
print_r( $posts );
foreach ( $posts as $post ) {
if ( false === strpos($post->post_title, 'selfie')) {
// safe to add non-selfie title post to array
$filtered_posts[] = $post;
}
}
return $filtered_posts ;
}
add_filter( 'posts_results', 'my_posts_results_filter' );
The input of this filter is an array of posts, created by any(?) WP_Query looking for posts.
The altered posts array.
Return to Plugin API/Filter Reference