w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Wordpress pre_get_posts category filter removes custom menu items

You may try this (No need for multiple if and $post_type = $post_type;)

add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
    if(is_category()  && $query->is_main_query()) {
        $query->set( 'post_type', array( 'post', 'Blog' ) );
    }
    return $query;
}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.