Claudio

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Hide tickets in products page #1132507
    Claudio
    Participant

    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.
    in reply to: Hide tickets in products page #1132464
    Claudio
    Participant

    Hi Geoff, thank you and i need hide tickets in product admin page woocomerce. this code is for page wp-admin woocomerce products?

    Thanks 😀

Viewing 2 posts - 1 through 2 (of 2 total)