I have run into a problem with arrays.
I need to overwrite search query and exclude posts. To do that, all I need is to exclude posts that have meta value called "hide_this_page" equal to "Yes".
So I have tried with meta query:
$wp_query = new WP_Query( array( 'post_type' => array('post','page', 'landing'), 's' => $_GET["s"], 'meta_query' => array( array( 'key' => 'hide_this_page', 'value' => 'Yes', 'compare' => '!=', ) ) ) );
But that returns no results.
Than I have tried other option and that was to use the 'post__not_in' argument like that:
$query = new WP_Query( 'post__not_in' => array( 2, 5, 12, 14, 20 ) ) );
But I have failed to create the array( 2, 5, 12, 14, 20 ) in PHP, I cannot get rid of the key value from the array. Can anybody please help with one or the other way?
Thank you very much!