Support » Plugin: WordPress Hide Posts » Menu items disappearing

  • Resolved Brian Jackson

    (@brianleejackson)


    Hello,
    I think there might be a bug in the most recent version, 0.4.3.

    I updated the plugin this evening and 15 minutes later my menu was gone. Added menu items back and then disappeared again later again. I found a thread from a similar plugin that also caused this:

    https://wordpress.org/support/topic/causes-menu-items-to-get-erased/

    I’ll try to gather some more information, including taking a look at my cron jobs and also testing the new version on a dev site. I see the changelog and I don’t see why this would have caused it, but I thought I would let you know.

    I went ahead and downloaded 0.4.2 again for a bit.

    Thanks

    • This topic was modified 4 months ago by Brian Jackson. Reason: typo
Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Martin

    (@martin7ba)

    Hello Brian,

    Thank you for reporting this.

    Can you tell me if version 0.4.2 is working correctly and the menu is not disappearing?

    Also can you tell me which version of WordPress you are using, php version and which theme or if you use some plugin for the menu?

    Best,
    Martin

    Plugin Author Martin

    (@martin7ba)

    Hello Brian,

    Do you use some of the posts you are hiding in the menu?

    I could not replicate the issue.

    Can you please tell me what theme you are using and if you use some plugin for the menu?

    Best,
    Martin

    Hey Martin,

    Yes version 0.4.2 is working fine.

    I’m using the GeneratePress theme (premium) and the native WordPress menu.
    On WordPress 5.4, PHP 7.4.

    I have a dev site and a couple of other sites running the same setup. I’m going to try and replicate the issue today. I will report back with what I find.

    Plugin Author Martin

    (@martin7ba)

    Hey Brian,

    Great, thank you for that.

    I tested locally with adding a post, that is marked as hidden, in the menu as link, but it didn’t get removed. So I wasn’t able to replicate the issue so far.

    Please do let me know if the issue shows again.
    In version 0.4.3 the only thing added was option to hide a post from the REST Routes. I am not sure how that can affect the menu, but it’s worth looking into it and I will continue testing it.

    Best,
    Martin

    Well, I haven’t been able to replicate it. And I ran the update (although it’s 0.4.4 now) on the original site again since I had some time to watch it and things are fine. Since then I cleaned up some old cron jobs from things no longer installed… so I guess we can just classify this as it fixed itself lol.

    Thanks for responding though, I appreciate it and love the plugin. I even feature it here: https://woorkup.com/hide-wordpress-posts/

    I will go ahead and mark this resolved.

    Plugin Author Martin

    (@martin7ba)

    Thank you Brian for featuring my plugin in your post.

    Great if it’s working now. Let me know if any issues show up again.

    I will be releasing a new version next week with few new updates.

    Best,
    Martin

    Guys,

    We have spent the entire day trying to fix our site and every hour, all menu items are gone again… we have gone through so many diagnostics to fix this and eventually found this post: https://wordpress.org/support/topic/menu-items-disappearing-3/

    and now we have the answer, your plugin is causing menu items to disappear.

    Please fix this asap so others don’t have this issue, we have disabled your plugin in the meantime.

    • This reply was modified 3 months, 1 week ago by ajjoshi.
    Plugin Author Martin

    (@martin7ba)

    Hi ajjoshi,

    So far I was not able to replicate the menu dispersing bug, and Brian above also said the issue is not showing and he could not replicate it.

    Which theme are you using?
    Also which version of the plugin?

    Maybe I can try to replicate using your theme.

    Do you have some custom coding done on the menu or maybe using some menu plugin?

    I understand you could not replicate it but 100% was the plugin, as soon as I deactivated, the issue was fixed.

    I was using latest version as I only installed it yesterday.
    I am using a custom theme

    Daniel Chase

    (@riseofweb)

    I don’t use this plugin but I am doing something similar via PHP on my website and my menu disappeared when I was hiding posts that had a specific tag. I found a helpful code that fixed it for me. https://wordpress.stackexchange.com/questions/53144/custom-search-filter-causes-menu-and-query-posts-problems

    && 'nav_menu_item' !== $query->get('post_type')

    My full code perhaps this might help someone:

    //Don't Show Certain Tags
    function tag_filter($query) {
    	if (!is_admin() && 'nav_menu_item' !== $query->get('post_type') && ($query->is_main_query() || $query->is_home() || $query->is_feed() || $query->is_search() || $query->is_archive() ) ) {
    		$query->set( 'tag','-24, -26' );
    	}
    }
    add_action('pre_get_posts', 'tag_filter');
    Plugin Author Martin

    (@martin7ba)

    Hey Daniel,

    Thank you for the input.

    I suspect the issue is that the code is not run on the main query. I set it to run on all queries to be able to hide posts that are not in the main query, but are shown on the page where the user would like to hide it.

    Ex: If there is some widget showing posts on homepage in sidebar and you want to hide that post in the mail loop of the homepage, but also in any other sections that where it can appear on the homepage.

    But, I will add check if the post_type is one of the selected post types. I hope that will fix the issue with the menu.

    I will release new version next week with new options and apply this fix and see how it goes.

    It is strange that happens to some specific themes. I have the plugin run on several sites of mine and I haven’t had that issue so far.

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.