Ask your WordPress questions! Pay money and get answers fast! (more info)

Help! Our navigation menu keeps mysteriously disappearing WordPress

  • SOLVED

Hello Wordpress Wizards,

Our main navigation menu keeps disappearing. It happens one item at a time every one or two days.

It's endlessly frustrating as we keep having to add the items back again. We're going a little insane and really hoping somebody can help.

We think it's probably a plugin issue after a bunch of updates were put through - but we have no idea how to identify the pesky plugin as the menu doesn't do it's disappearing act right away.

To test by disabling plugins one by one may take weeks!

<strong>More info:</strong>

1) Only menu items that are pages or posts disappear. Category menu items stay put for some reason.

2) There seems to be an order to the disappearing. E.g. 'Home' and child menu items are usually the first to go.

3) There's nothing related or recent in the error_log

4) Our server, and CloudFlare service (site speed/caching/security) see no problems from their end


Our website: reauthoringteaching.com


Good luck!


Answers (5)

2014-06-01

Dbranes answers:

How many items do you have in the nav-menu ?

I've seen this issue appearing recently, for few menu items, for example reported here:

- [[LINK href="http://wordpress.stackexchange.com/questions/145811/menu-items-all-menus-being-deleted-randomly-on-their-own"]]http://wordpress.stackexchange.com/questions/145811/menu-items-all-menus-being-deleted-randomly-on-their-own[[/LINK]]

- [[LINK href="http://wordpress.stackexchange.com/questions/145583/all-menu-items-disappear-seemingly-at-random"]]http://wordpress.stackexchange.com/questions/145583/all-menu-items-disappear-seemingly-at-random[[/LINK]]

- [[LINK href="http://wordpress.stackexchange.com/questions/145953/wp-delete-auto-drafts-deletes-links-in-menus"]]http://wordpress.stackexchange.com/questions/145953/wp-delete-auto-drafts-deletes-links-in-menus[[/LINK]]

- [[LINK href="http://wordpress.stackexchange.com/questions/64487/nav-menu-items-disappearing-but-not-immediately"]]http://wordpress.stackexchange.com/questions/64487/nav-menu-items-disappearing-but-not-immediately[[/LINK]]

Some ideas have come forward there, for example:

- create a logger, check for example [[LINK href="http://wordpress.stackexchange.com/a/65355/26350"]]this idea[[/LINK]].
- create a dev blog without any plugins and the default theme and change it step by step, but this may take some time.

<strong>Update:</strong>

If you want to know when the <em>nav menu items</em> change, then here's an example of a <em>nav menu items</em> count logger:

/**
* A logger for nav menu items count
*
* @link http://www.wpquestions.com/question/showChronoLoggedIn/id/9618
*/

function wpq_debug_nav_menu_items( $items, $menu, $args ) {

$file = '/full/path/to/debug-menu-items.log'; // Edit this filepath to your needs.

if( file_exists( $file )
&& is_writeable( $file )
) {
$s = sprintf( " %s - menu: %s - count: %d %s" , date( "c" ),
$menu->slug,
$menu->count,
PHP_EOL
);
file_put_contents( $file, $s, FILE_APPEND | LOCK_EX );
}

return $items;
}

add_filter( 'wp_get_nav_menu_items', 'wpq_debug_nav_menu_items', 99, 3 );


You can modify this to your needs, just make sure to change <em>$file</em> settings and that the log file is writeable.

You could also consider logging your SQL queries:

/**
* Dump all SQL queries to a file.
*
* @link http://www.wpquestions.com/question/showChronoLoggedIn/id/9618
*/

function wpq_debug_sql_queries() {

$file = '/full/path/to/debug-sql-queries.log'; // Edit this filepath to your needs.

if( file_exists( $file )
&& is_writeable( $file )
&& isset( $GLOBALS['wpdb']->queries )
) {
file_put_contents(
$file,
date( 'c' ) . PHP_EOL . print_r( $GLOBALS['wpdb']->queries, TRUE ),
FILE_APPEND | LOCK_EX
);
}

}

add_action( 'shutdown', 'wpq_debug_sql_queries' );


You just have to modify the <em>$file</em> settings and remember to add the following line:

define( 'SAVEQUERIES', TRUE );


to your <em>wp-config.php</em> file.

Notice this might add extra load to your site, but for moderate traffic, it shouldn't be that heavy.


Dbranes comments:

I updated the answer with some example loggers, just keep in mind that when you copy/paste code from this site, you get extra new lines.


Foresme comments:

Heya Dbranes,

Thanks for your answer. I followed one of the links you listed which tracked the problem to the 'stealth publish' plugin and the WP 3.9 update.

I've disabled the plugin and I'm going to wait 24 hours to see if the menu keeps all its soldiers.

Will report back!


Dbranes comments:

Hi Foresme,

Let's hope that this is the plugin that's causing all your problems ;-)

I skimmed through the HTML source of your page to see if you got the plugin, but I didn't find any trace of it there. I guess the <em>Stealth Publish</em> plugin is living up to it's name ;-)

At least this bug was reported to the plugin author, 3 days ago:

[[LINK href="http://wordpress.org/support/topic/causes-menu-items-to-get-erased"]]http://wordpress.org/support/topic/causes-menu-items-to-get-erased[[/LINK]]


Looking forward to your update in 24 hours.


Foresme comments:

Dbranes!

The fix worked. The pesky 'stealth publish' plugin was the culprit.

Thank you my friend.

2014-05-31

zebra webdesigns answers:

Hello foresme

In the backend of wordpress dashboard
Go to appearance -> Menu
And see whether auto add new pages is enabled.

One more question is are you adding pages often [ not posts]


zebra webdesigns comments:

One more info I need is , when the menu disappears , is there any other menu appearing instead ??

From my experience I can relate the problem with menu limiting factor
See the below article.

http://sevenspark.com/wordpress/menu-item-limit

But this happens when you add new menu.
If you need an inside look , can you pm me the login detail


Foresme comments:

Hey Zebra,

1) Auto add menu items is NOT enabled

2) We're not adding new items to the menu often. The menu has been relatively stable for months now

3) When an item disappears nothing appears in its place


Thanks for your quick response! Might take you up on the offer to PM you admin details if not other solutions come through on this thread!

Thanks.

2014-06-01

timDesain Nanang answers:

try to repair the wordpress database

- login to cpanel
- go to MySQL Databases
- select the wordpress database
- tick select all (or tick the _posts table only)
- select Repair Table (if you are using MyISAM Tables)

2014-06-01

smc answers:


smc comments:

there is any cron job running in the system ?
you can check it using this plugin

https://wordpress.org/plugins/cron-view/

2014-06-01

Romel Apuya answers:

Hi,

Try increasing the max_input_vars value of your server.

here is an example of how to [[LINK href="http://diywpblog.com/how-to-increase-max-input-vars/"]]INCREASE MAX INPUT VARS[[/LINK]]

try max_input_vars = 5000