1 2 3 4 5 6 7 8 |
function wpm_search_filter( $query ) { if ( $query->is_search && ! is_admin() ) { $query->set( 'post_type', array( 'case' ) ); } return $query; } add_filter( 'pre_get_posts', 'wpm_search_filter' ); |
1 2 3 4 5 6 7 8 |
function wpm_add_custom_types( $query ) { if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', array( 'post', 'case' )); return $query; } } add_filter( 'pre_get_posts', 'wpm_add_custom_types' ); |