alanchrishughes
Member
Posted 1 year ago #
This is the only thing I've been able to find on this topic, but the thread is closed for some reason, and it isn't working entirely.
http://wordpress.org/support/topic/register_post_type-not-showing-tags?replies=3
It does show the tags box when writing your post, and the tag will appear in your tag cloud, but when you click said tag the results page do not include posts from the new post type. Any ideas?
alanchrishughes
Member
Posted 1 year ago #
Never mind, I just found this thread that seems to have done the trick
http://wordpress.org/support/topic/custom-post-type-tagscategories-archive-page?replies=40
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
$post_type = array('post','cpt'); // replace cpt to your custom post type
$query->set('post_type',$post_type);
return $query;
}
}
alanchrishughes
Member
Posted 1 year ago #
But this also breaks my wp_menu
alanchrishughes
Member
Posted 1 year ago #
They have a partial fix lower on that page but it only fixes the wp_menu problem for tag pages, and the category pages still have the problem
Change this line:
if(is_category() || is_tag()) {
-to-
if ( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {