Menu items disappeared and can’t be saved
-
Hello,
After updating to WP 6.0, my menu disappeared.
I went to the Admin Menu Panel and found my menus empty.
I have then tried to add some elements and clicked on SAVE.
The page refresh without errors and return an empty menu.About troubleshooting:
If I’m using “Twenty-Twenty”, it is working properly.
I have installed “Health Check & Troubleshooting”, activated it.
I’m using our own theme and it needs ACF to run.
I can’t find any functions that could affect the menu functions in our theme.
There is no errors in the console.Please let me know where I could find the changes in the last update related to menus. Or what can I use to repair the menus.
The page I need help with: [log in to see the link]
-
Please review WordPress 6.0 Master List and attempt troubleshooting steps outlined therein
Thanks, but I already reviewed that list.
Here is the Health info:
### wp-core ### version: 6.0 site_language: en_US user_language: en_US timezone: America/Toronto permalink: /%year%/%monthnum%/%day%/%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: closed environment_type: production user_count: -1 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /var/www/html wordpress_size: 83.85 MB (87921400 bytes) uploads_path: /var/www/html/wp-content/uploads uploads_size: 2.03 GB (2181763844 bytes) themes_path: /var/www/html/wp-content/themes themes_size: 29.04 MB (30450492 bytes) plugins_path: /var/www/html/wp-content/plugins plugins_size: 79.59 MB (83458990 bytes) database_size: 234.09 MB (245464404 bytes) total_size: 2.45 GB (2629059130 bytes) ### wp-active-theme ### name: European Textiles (europeantextiles) version: 1.0 author: Orbital author_website: https://orbital.ca/ parent_theme: none theme_features: core-block-patterns, post-thumbnails, widgets-block-editor, woocommerce, menus, widgets theme_path: /var/www/html/wp-content/themes/europeantextiles auto_update: Disabled ### wp-themes-inactive (5) ### Twenty Fifteen: version: 3.2, author: the WordPress team, Auto-updates disabled Twenty Nineteen: version: 2.3, author: the WordPress team, Auto-updates disabled Twenty Twenty: version: 2.0, author: the WordPress team, Auto-updates disabled Twenty Twenty-One: version: 1.6, author: the WordPress team, Auto-updates disabled Twenty Twenty-Two: version: 1.2, author: the WordPress team, Auto-updates disabled ### wp-mu-plugins (1) ### Health Check Troubleshooting Mode: author: (undefined), version: 1.7.2 ### wp-plugins-inactive (29) ### Adminimize: version: 1.11.7, author: Frank Bültge, Auto-updates enabled Advanced Custom Fields: version: 5.12.2, author: Delicious Brains, Auto-updates disabled BackUpWordPress: version: 3.13, author: XIBO Ltd, Auto-updates enabled Bulk Edit Products, Prices & Attributes for Woocommerce (Basic): version: 2.3.5, author: XAdapter, Auto-updates disabled Categories Images: version: 3.0.1, author: Muhammad El Zahlan, Auto-updates enabled Classic Editor: version: 1.6.2, author: WordPress Contributors, Auto-updates enabled Disable Gutenberg: version: 2.7, author: Jeff Starr, Auto-updates enabled Google Analytics Dashboard: version: 2.1.1, author: Team Yoast & Carson McDonald, Auto-updates disabled Google XML Sitemaps: version: 4.1.1, author: Auctollo, Auto-updates enabled Health Check & Troubleshooting: version: 1.4.5, author: The www.ads-software.com community, Auto-updates disabled Import and export users and customers: version: 1.19.3, author: codection, Auto-updates enabled Links CPT by Orbital: version: 1.0.0, author: Orbital, Auto-updates disabled Ninja Forms: version: 3.6.9, author: Saturday Drive, Auto-updates enabled Powerful Posts Per Page: version: 1.1.0, author: Toro_Unit, Auto-updates enabled Redirection: version: 5.2.3, author: John Godley, Auto-updates enabled Right Now Reloaded: version: 2.2, author: Michael Dance, Auto-updates enabled Search Everything: version: 8.1.9, author: Sovrn, zemanta, Auto-updates enabled ShareThis Dashboard for Google Analytics: version: 2.5.4, author: ShareThis, Auto-updates enabled Slides CPT by Orbital: version: 1.0.0, author: Orbital, Auto-updates disabled WooCommerce: version: 6.5.1, author: Automattic, Auto-updates enabled WooCommerce Canada Post Shipping: version: 2.5.27, author: WooCommerce, Auto-updates enabled WooCommerce Measurement Price Calculator: version: 3.20.1, author: SkyVerge, Auto-updates enabled WooCommerce Remove Product Sorting: version: 1.2.0, author: SkyVerge, Auto-updates disabled WooCommerce Stripe Gateway: version: 6.4.0, author: WooCommerce, Auto-updates enabled Wordfence Security: version: 7.5.10, author: Wordfence, Auto-updates enabled WordPress Importer: version: 0.7, author: wordpressdotorg, Auto-updates enabled WP-Sweep: version: 1.1.5, author: Lester 'GaMerZ' Chan, Auto-updates enabled WP Backup Plugin: version: 1.2, author: Umar, Auto-updates disabled WP Mail SMTP: version: 3.4.0, author: WPForms, Auto-updates enabled ### wp-media ### image_editor: false imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 8M upload_max_filesize: 2M max_effective_size: 2 MB max_file_uploads: 20 gd_version: not available ghostscript_version: not available ### wp-server ### server_architecture: Linux 5.4.0-81-generic x86_64 httpd_software: Apache/2.4.41 (Ubuntu) php_version: 7.4.23 64bit php_sapi: apache2handler max_input_variables: 10000 time_limit: 30 memory_limit: 128M admin_memory_limit: 256M max_input_time: 60 upload_max_filesize: 2M php_post_max_size: 8M curl_version: 7.68.0 OpenSSL/1.1.1f suhosin: false imagick_availability: false pretty_permalinks: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 8.0.26 client_version: mysqlnd 7.4.23 max_allowed_packet: 67108864 max_connections: 151 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /var/www/html/wp-content WP_PLUGIN_DIR: /var/www/html/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable
I have found the function that was creating the issue.
I have not corrected the function yet.add_action( ‘pre_get_posts’, ‘our_pre_get_posts’ );
function our_pre_get_posts( $query ) {
if ( $query->is_archive ) {
$query->set( ‘order’, ‘ASC’ );
$query->set( ‘orderby’, ‘title’ );
}
if ( $query->is_tag || $query->is_tax ) {
$query->set( ‘post_type’, array( ‘product’ ) );
$query->set( ‘posts_per_page’, 18 );
}
if ( $query->is_tag ) {
$query->set( ‘posts_per_page’, 18 );
}
if ( $query->is_search ) {
$query->set( ‘posts_per_page’, 18 );
}
}adding on item to the menu and saving the menu restores all old items (+the newly added) – suboptimal but saves the day
only saving without adding a menu item does not do anything
- This reply was modified 2 years, 5 months ago by hunters-best.
I had to remove the hook to make it work.
It was preferable to downgrade to 5.9 in my opinion.
I haven’t received any details on how to correct it thoughSide note to @duke78 , @mranner ,
Please do not jump into other topics . – If the troubleshooting already posted made no difference for you, then please start your own topic. A lot more people will see your post, and that way you stand a good chance of getting the assistance you want. Despite any similarity in symptoms, your issue is likely to be completely different because of possible differences in physical servers, accounts, hosts, plugins, theme, configurations, etc. Thus one problem, on one setup is not indicative of the functionality and reliability of an application as a whole.
I’ll be archiving your post and mine too not spam the original poster.
@orchestrated Thanks for your input here. I have the same issue. I found https://www.ads-software.com/support/topic/menu-items-disappeared-and-cant-be-saved/#post-15680497 and https://www.ads-software.com/support/topic/menu-items-disappeared-and-cant-be-saved/#post-15716554 helpful.
Could you let me know exactly the path of where that code is?
How did you ultimately resolve and along everything to go back to normal? What is the optimal method in your opinion?
I would appreciate any insight you have on this since you faced the exact same thing I am currently.
??
@hunters-best This really worked wonders for me when testing on staging https://www.ads-software.com/support/topic/menu-items-disappeared-and-cant-be-saved/#post-15702531 and I thank you so much for this little comment. I would not have known to try this without you taking the time to post. However, when I do the same thing on a WP Multisite (see here https://www.ads-software.com/support/topic/appearancemenus-disappear-when-updating/#post-16192748 ), it works initially but after about 15 min or so the menus disappear again. Any thoughts or ideas on that or things to try? I am going to try another round of testing and trying other things to get the menus to stick and not disappear soon (since it is on a live WP Multisite Network I have to plan a bit in my sprints to finally solve…almost there just need to solve this final piece). I have some other ideas to try like disabling Mega Menu before and/or after the upgrade (which the 6 subsites share in common and some other things). 40 of my subsites have no upgrading issues with menus…I only have 6 specific subsites that have this issue it appears. I have done plugin conflict tests and theme conflict tests etc. See my latest here https://www.ads-software.com/support/topic/appearancemenus-disappear-when-updating/#post-16192748 Any other ideas or input you may have or have come across since you had similar issues I would greatly appreciate! ?? Greg
Hi @orchestrated,
Thank you so much for sharing this information! It has been bugging me since WP 6.0 was released. I have only one line in the pre_get_posts hook. Removing it fixes the issue.
$query->set( ‘post_type’, array( ‘my-custom-type’ ) );
Any idea why this caused the issue? They seem completely unrelated.
I found a reference here that explains the cause of the problem: https://wordpress.stackexchange.com/a/52408/47947
Because “Nav menus are also generated by a WP_Query”, running
$query->set
filters out the menu items. The solution is to add a condition to limit the query to the “main query” only. For example:if ($query->is_main_query() && $query->is_archive()) { // set up main query }
- The topic ‘Menu items disappeared and can’t be saved’ is closed to new replies.