Support » Plugin: Conditional Menus » Does not work with custom taxonomies

  • The UI of this plugin is very misleading. When editing conditions for a menu you are presented with ALL possible taxonomies. However, if you choose to base your conditions on a custom taxonomy you’re up for disappointment (and possibly confusion).

    There is absolutely no logic implemented in the plugin for custom taxonomies (I’ve verified this by reading the source code and also stepping through the running code using a debugger).

    I had to write the code for custom taxonomies myself and added the following inside the if(is_singular()) block, around line 270 or so:

    // Test for custom taxonomies
    $post_taxonomies = get_post_taxonomies(get_the_ID());
    foreach ($post_taxonomies as $post_taxonomy_name) {
        if (isset($logic['tax'][$post_taxonomy_name])) {
            $logic_term_slug = array_keys($logic['tax'][$post_taxonomy_name])[0];
            $post_terms = get_the_terms(get_the_ID(), $post_taxonomy_name);
            if ($post_terms) foreach ($post_terms as $post_term) {
                if ($post_term->slug === $logic_term_slug) {
                    $visible = true;
    // -- end test for custom taxonomies

    Disclaimer: The code above was custom made to solve my particular problem and was tested only in that situation. It is not meant to be generic and is not thoroughly tested. Although it might work for you, don’t just copy/paste the code unless you know what you are doing.

    I would kindly ask the developer Themify to either:

    • Preferably: Add code to the plugin to actually check all possible conditions, including custom taxonomies, custom post types etc. Feel free to use the code above as a starting point if that helps.
    • Or at the very least: Update the UI so that only the taxonomies etc that the plugin actually respects are presented when editing conditions.
    • This topic was modified 5 years, 7 months ago by Tomas Eklund. Reason: Formatting
    • This topic was modified 5 years, 7 months ago by t-p.
Viewing 5 replies - 1 through 5 (of 5 total)
  • I need this supported as well, it was the reason I installed the plugin.

    It still has the same problem. Friend code did not work for me. I really need this function.

    I am also having an issue with this. I’m using a plugin that creates it’s own custom taxonomies (ideapush) and when I enable it, the Conditional Menus interface fails to load properly so I cannot edit my menus anymore until deactivating the other plugin.

    I’ve contacted the ideapush plugin developer and I was told that for some reason Conditional Menus doesn’t like his custom taxonomy called ‘status’.

    Please help.

    • This reply was modified 4 years, 7 months ago by kaizerco.

    I think they just fixed it in the latest version 1.1.1 ? 🙂

    • This reply was modified 4 years, 6 months ago by kaizerco.
    Thread Starter Tomas Eklund


    I haven’t installed it or tested the new 1.1.1 version but I’ve “diffed” the code against the previous version (checked the differences line by line in the source code) and I can’t see that they would have added any code to check for custom taxonomies. It only appears to be very minor code fixes and clean-up.

    @kaizerco Have you tested the new version and found it to work with custom post types and custom taxonomies?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Does not work with custom taxonomies’ is closed to new replies.