Label Disappears with Custom Meta Query
-
Hello,
I’m trying to add a custom meta query to my shop. Whenever I do, the Advanced Labels disappear completely. Why does this happens and how could I go about fixing it? Here’s the custom meta query I’m working with:
add_action( 'pre_get_posts', function( $query ) { if( is_admin() ) { return; } if( isset( $_GET, $_GET['in_stock'] ) ) { $meta_query = (array)$query->get( 'meta_query', array() ); $meta_query[] = array( array( 'key' => '_stock_status', 'value' => 'instock', ), ); $query->set( 'meta_query', $meta_query ); } } );
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Label Disappears with Custom Meta Query’ is closed to new replies.