Thank you Geoff, i am making and edited this code at the forum wordpress:
add_action( 'pre_get_posts', 'custom_pre_get_posts' );
function custom_pre_get_posts( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
$not_posts = array();
$not_p = get_posts(array('post_type'=>'product','meta_query' => array(
array(
'key' => '_tribe_tickets_meta_enabled',
'value' => '',
'compare' => '!='
)
)));
foreach ($not_p as $post) { $not_posts[] = $post->ID; }
$q->query_vars['post__not_in'] = $not_posts;
remove_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
}
It works! 😀
-
This reply was modified 9 years, 10 months ago by
Claudio.