WordPress.org

Ready to get started?Download WordPress

Forums

Worpdress Paradox - Normal posts not beign queried (1 post)

  1. Giruela
    Member
    Posted 1 year ago #

    I am in a situation that i can't figure out. I am running a WP 3.4.2 on a site with multiple custom post types. The normal posts are displayed in the blog section and are in a category called blog with different subcategories.

    Blog posts and another post type called 'events' display tags in single view. The tags display fine but when you click on a blog post tag no posts are found. Tags related to events work as expected.

    The really weird thing is in admin. when i search a tag that is related to a normal post, it finds it and counts how many posts it has, but when clicking on the number of posts is says "No posts found.". With the tags related to events this never happens.

    Also, categories have the same problem.. display just posts from events..

    Also i tried to make another post type called "blogposts" to display on the blog page instead of normal posts but same sad story.

    As far as i see in the code, in archive.php and tag.php, normal posts are not returned from the query, just events get through.

    i have this in functions.php

    function namespace_add_custom_types( $query ) {
            if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
               $query->set( 'post_type', array('post', 'events', 'blogposts' ));
               return $query;
    }
    }
    
                 add_filter( 'pre_get_posts', 'namespace_add_custom_types' );

    Any ideas would be really welcomed. Thanks!

    the webpage: http://www.sunrise.ro/new/blog

Topic Closed

This topic has been closed to new replies.

About this Topic