Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Include custom post type in default category archives
- // Ref link: http://wordpress.org/support/topic/custom-post-type-tagscategories-archive-page
- add_filter('pre_get_posts', 'query_post_type');
- function query_post_type($query) {
- if( is_category() || is_tag() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
- $post_type = get_query_var('post_type');
- $post_type = array('post','adverts','nav_menu_item'); // replace cpt to your custom post type
- $query->set('post_type',$post_type);
- return $query;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement