WordPress.org

Ready to get started?Download WordPress

Forums

TagPages
[resolved] PageTags cause tag results to lose menu (7 posts)

  1. whiteorb
    Member
    Posted 2 years ago #

    Not sure why this is occuring but the page menu disappears when I view a list of tags e.g. http://www.openeye.net/tag/analog. It only happens when the plugin is enabled.

    With Menu (plugin off)
    http://pastebin.com/gPHUAVAW

    Without Menu (plugin on)
    http://pastebin.com/vfcuHNvj

    Any thoughts on what could cause this?

  2. Bernhard Riedl
    Member
    Plugin Author

    Posted 2 years ago #

    Hi whiteorb,

    Hmm, I've never heard of such an issue before. - Maybe there's a conflict with another plugin or your theme.

    To test please deactivate all plugins and reload your test-page with only TagPages activated. If it worked, try to activate one plugin after another and reload the page each time.

    If it didn't work, try to setup one of the default themes (TwentyTen or TwentyEleven).

    Greetz,
    Berny

  3. whiteorb
    Member
    Posted 2 years ago #

    It doesn't occur with the default themes. Can you think of anything that could possibly cause this?

  4. whiteorb
    Member
    Posted 2 years ago #

    It doesn't occur with the default themes. Can you think of anything that could possibly cause this?

  5. whiteorb
    Member
    Posted 2 years ago #

    So it was caused by this function

    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', 'software', 'documents', 'news', 'nav_menu_item', 'page');
        $query->set('post_type',$post_type);
    	return $query;
        }
    }

    Fortunately, I don't need it any longer. Curious though why that would happen.

  6. Bernhard Riedl
    Member
    Plugin Author

    Posted 2 years ago #

    Cool. - You found the issue. :) I'm also curious, so here's an idea:

    As I also use a pre_get_posts-filter to manipulate the post_type in $wp_query, it looks to me like a race condition between the two filters.

    Your code sets the post_type to array('post', 'software', 'documents', 'news', 'nav_menu_item', 'page'); if the post_type has not been set before.

    TagPages sets the post_type to array('post', 'page') if the post_type has not been set before.

    So, if the TagPages-filter is executed before your filter, it will never reach your else-fork.

    The default $priority = 10 for all filters, so I think setting your function to a higher priority (e.g. to 9) would achieve the desired functionality.

  7. whiteorb
    Member
    Posted 2 years ago #

    Ah ok, so I set the priority before the function and that seemed to resolve another issue that had come up. Very cool!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags