Support » Plugins » Menu empty when Polylang and Sticky Custom Post Types plugins are activated

  • Resolved Nico


    I’m running the latest version of both plugins (0.8.10 for polylang and 1.5.4 for sticky CPT) and the latest WP (3.4.1), and the language based menu is empty (please note that the flag widget is working; that’s only with the custom menus that it’s not working).


Viewing 11 replies - 1 through 11 (of 11 total)
  • Are yous sure the problem is not coming from your theme?
    The most frequent issue for menus is a conflict between Polylang and themes which are hardcoding the menu name. See:

    My own menus do not disappear when I hav both plugins activated

    Could you have look to the development version (0.9dev35, *for tests only*) and tell me if it solves the issue?

    Hi Chouby,
    Yes I am 100% positive as this is a theme I’ve made from scratch and I’ve already tried your fix, unfortunately that did not fix it as I was already using the wp_nav_menu() function.
    The dev version didn’t fix it either.


    please note that your dev version breaks my the_category() call (returns empty) on a while() loop on a CPT (weirdly it happens only in ONE of my CPTs!).

    Could you be more precise on your problem with the menu (the difference you have when you activate only one plugin or both)?

    For ‘the_category’, do you mean it works with 0.8.10 and not in 0.9dev ? Could you please tell me how your cpt has been registered? What is the difference with others?

    When your plugin only is activated, my menus are perfectly working, I mean the div and the ul are filled. When I activate both plugins, I just get the following:
    <div class="menu-english-menu-container"><ul id="menu-english-menu" class="menu"></ul></div>

    Yes that’s what I mean exactly.
    This is how it’s registered:

    $labels = array(
    			'name' => _x('Projects', 'post type general name', 'vd'),
    			'singular_name' => _x('Project', 'post type singular name', 'vd'),
    			'add_new' => _x('Add New', 'Project', 'vd'),
    			'add_new_item' => __('Add New Project', 'vd'),
    			'edit_item' => __('Edit Project', 'vd'),
    			'new_item' => __('New Project', 'vd'),
    			'all_items' => __('All Projects', 'vd'),
    			'view_item' => __('View Project', 'vd'),
    			'search_items' => __('Search Projects', 'vd'),
    			'not_found' =>	__('No Projects found', 'vd'),
    			'not_found_in_trash' => __('No Projects found in Trash', 'vd'),
    			'parent_item_colon' => '',
    			'menu_name' => 'Projects'
    		$args = array(
    			'labels' => $labels,
    			'public' => true,
    			'publicly_queryable' => true,
    			'show_ui' => true,
    			'show_in_menu' => true,
    			'query_var' => true,
    			'rewrite' => true,
    			'capability_type' => 'post',
    			'has_archive' => true,
    			'hierarchical' => false,
    			'menu_position' => null,
    			'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields' ),
    			'taxonomies' => array('category')
    		register_post_type('project', $args);

    The only difference with the other one working is the last two lines, like this in the other working:
    'supports' => array( 'title', 'thumbnail', 'custom-fields' )
    (no taxonomy)

    Hope it helps!

    Well. I catched the bug for ‘the_category’ in 0.9 and will add the correction to the dev version soon. Thank you very much for pointing it out.

    However I still do not reproduce the conflict between the two plugins. I made my tests with the same versions of plugins as you, your custom post type ‘project’, WP 3.4.1 and twenty ten. I also went through the code of Sticky Custom Post Types and yet could not find any reason for a conflict in menus.

    No worries!

    You’re right, that’s even more tricky than that, as this bug is ONLY happening when I activate polylang, Sticky Cutom Types AND Post Types Order plugins. Not happening when it’s only two of them, but definitively when both are activated!

    Got it !
    Polylang is not involved in the conflict, since I reproduced the bug with Polylang deactivated. It is a conflict between Sticky Custom Types and Post Types Order plugins.

    Due to plugin names, Post Types Order filters are executed before Sticky Custom Types filters.

    In pre_get_posts filter, Sticky Custom Types takes care to honor the suppress_filter parameter and thus normally does not break the query for post_type == nav_menu_item (suppress_filter is set to 1 by WP). But Post Types Order always set suppress_filter to false and thus the other plugin is messed.

    The solution is to add this in one personal plugin

    remove_filter('pre_get_posts', 'CPTO_pre_get_posts');
    add_filter('pre_get_posts', 'CPTO_pre_get_posts', 100); // after Sticky Custom Types

    Thank you very much although the bug wasn;t caused by your plugin Chouby!
    Instead of creqating a new plugin, I just appened your code to the Sticky Custom Types plugin, and it works perfectly.
    If this plugin gets updated and it’s broken again, I’ll just do the same again until it’s fixed.

    Thank you very much for your help and your awesome plugin!

    You helped me with with your bug report on v0.9 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Menu empty when Polylang and Sticky Custom Post Types plugins are activated’ is closed to new replies.