Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double Menu Problem after Updates #27205

Open
6 tasks done
wharminda opened this issue May 2, 2024 · 7 comments
Open
6 tasks done

Double Menu Problem after Updates #27205

wharminda opened this issue May 2, 2024 · 7 comments
Labels
status/awaiting_triage Indicates when an Issue, Pull Request, or Discussion awaits to be triaged.

Comments

@wharminda
Copy link

wharminda commented May 2, 2024

UPDATE 9-5-24

another site broken, same fix works.

Happy to give you access to a site that breaks frequently if you want to take a look.

UPDATE 7-5-24

I've had another site break and tested this SQL and it fixed the problem:
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http', 'https')
WHERE option_name = '_elementor_assets_data';

Which suggests that the below is indeed the issue.

Prerequisites

  • I have searched for similar issues in open and closed tickets and cannot find a duplicate.
  • I have troubleshooted my issue, and it still exists against the latest stable version of Elementor.

Description

The double menu problem, which is widely complained about, appears to be caused by the browser not finding this file:
/wp-content/plugins/elementor-pro/assets/css/widget-nav-menu.min.css
which is probably because it's listed as http instead of https:

This file location is stored in the database at:
table = Options, column option_name = _elementor_assets_data

SQL to find it:

select * from wp_options
WHERE option_name = '_elementor_assets_data ';

The data is either not being updated or, more likely, some part of the update process is adding the URL as http instead of https and the browser is blocking the mixed content OR some part of the code is looking for HTTPS instead of HTTP and not linking it in as required CSS (or something else is the problem).

See the BEFORE and AFTER relevant sections from the Option_Value column.

I changed only the http to https via phpMyAdmin Edit function and this fixed the issue. That might be because something realised there had been a db change and called some other process or it might be because that's all that caused the problem.

After changing to https, the site worked and I checked the data in the table again, and it had been updated with new versions, see the code below, so something triggered the update.

BEFORE
s:8:"nav-menu";a:2:{s:7:"content";s:123:"";s:7:"version";s:6:"3.21.2";}s:7:"divider";a:2:{s:7:"content";s:4311:"<style>/*! elementor - v3.21.0 - 30-04-2024 */

AFTER
s:8:"nav-menu";a:2:{s:7:"content";s:124:"";s:7:"version";s:6:"3.21.2";}s:4:"icon";a:2:{s:7:"content";s:0:"";s:7:"version";s:6:"3.21.4";}s:7:"divider";a:2:{s:7:"content";s:4311:"<style>/*! elementor - v3.21.0 - 30-04-2024 */

Please note that I only have one site at the moment with this issue, so I cannot validate this, but will attempt to next time a site breaks, which happens about once every 2 weeks.

Steps to reproduce

  1. All details are above
  2. thanks

Expected behavior

  1. All details are above
  2. thanks

Isolating the problem

  • This bug happens when only the Elementor (and Elementor Pro) plugins are active.
  • This bug happens with the Hello Elementor theme active.
  • I can reproduce this bug consistently by following the steps I described above.

Elementor System Info

Click to reveal
== Server Environment ==
	Operating System: Linux
	Software: Apache
	MySQL version: MariaDB Server v10.6.17
	PHP Version: 8.1.28
	PHP Memory Limit: 256M
	PHP Max Input Vars: 1000
	PHP Max Post Size: 20M
	GD Installed: Yes
	ZIP Installed: No
	Write Permissions: All right
	Elementor Library: Connected

== WordPress Environment ==
	Version: 6.5.2
	WP Multisite: No
	Max Upload Size: 20 MB
	Memory limit: 256M
	Max Memory limit: 256M
	Permalink Structure: /%postname%/
	Language: en_AU
	Timezone: Australia/Adelaide
	Debug Mode: Inactive

== Theme ==
	Name: Hello Elementor Child
	Version: 1.0.1
	Author: Elementor Team
	Child Theme: Yes
	Parent Theme Name: Hello Elementor
	Parent Theme Version: 3.0.1
	Parent Theme Author: Elementor Team

== User ==
	Role: administrator
	WP Profile lang: en-AU
	User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:125.0) Gecko/20100101 Firefox/125.0

== Active Plugins ==
	Akeeba Backup Professional for WordPress
		Version: 8.2.1
		Author: Akeeba Ltd

	Classic Editor
		Version: 1.6.3
		Author: WordPress Contributors

	Converter for Media
		Version: 5.12.5
		Author: matt plugins

	Disable Emojis (GDPR friendly)
		Version: 1.7.6
		Author: Ryan Hellyer

	Elementor
		Version: 3.21.4
		Author: Elementor.com

	Elementor Pro
		Version: 3.21.2
		Author: Elementor.com

	WPS Hide Login
		Version: 1.9.15.2
		Author: WPServeur, NicolasKulka, wpformation

	Yoast SEO
		Version: 22.6
		Author: Team Yoast


== Must-Use Plugins ==
	akeeba-backup-coreupdate.php
		Version: 
		Author: 


== Features ==
	Custom Fonts: 0
	Custom Icons: 0

== Integrations ==
	


== Elementor Experiments ==
	Improved Asset Loading: Active by default
	Improved CSS Loading: Active by default
	Inline Font Icons: Inactive by default
	Additional Custom Breakpoints: Active by default
	admin_menu_rearrangement: Inactive by default
	Flexbox Container: Inactive by default
	Upgrade Swiper Library: Active by default
	Grid Container: Active by default
	Nested Elements Performance: Inactive by default
	Optimized Control Loading: Inactive by default
	Default to New Theme Builder: Active by default
	Hello Theme Header & Footer: Active by default
	Elementor Home Screen: Active by default
	Editor Top Bar: Inactive by default
	Build with AI: Active by default
	Landing Pages: Active by default
	Nested Elements: Inactive by default
	Lazy Load Background Images: Inactive by default
	Display Conditions: Inactive by default
	Form Submissions: Active by default
	Menu: Inactive by default
	Taxonomy Filter: Inactive by default


== Log ==
	
Log: showing 20 of 422024-04-24 15:07:54 [info] elementor::elementor_updater Started 
2024-04-24 15:07:54 [info] Elementor/Upgrades - _on_each_version Start  
2024-04-24 15:07:54 [info] Elementor/Upgrades - _on_each_version Finished 
2024-04-24 15:07:54 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.0',
  'to' => '3.21.1',
)]
2024-04-24 15:07:54 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.0',
  'to' => '3.21.1',
)]
2024-04-26 22:29:22 [info] elementor::elementor_updater Started 
2024-04-26 22:29:22 [info] Elementor/Upgrades - _on_each_version Start  
2024-04-26 22:29:22 [info] Elementor/Upgrades - _on_each_version Finished 
2024-04-26 22:29:22 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.1',
  'to' => '3.21.3',
)]
2024-04-26 22:29:22 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.1',
  'to' => '3.21.3',
)]
2024-05-01 02:36:25 [info] elementor::elementor_updater Started 
2024-05-01 02:36:25 [info] Elementor/Upgrades - _on_each_version Start  
2024-05-01 02:36:25 [info] Elementor/Upgrades - _on_each_version Finished 
2024-05-01 02:36:25 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.3',
  'to' => '3.21.4',
)]
2024-05-01 02:36:25 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor',
  'from' => '3.21.3',
  'to' => '3.21.4',
)]
2024-05-01 02:36:34 [info] elementor-pro::elementor_pro_updater Started 
2024-05-01 02:36:34 [info] Elementor Pro/Upgrades - _on_each_version Start  
2024-05-01 02:36:34 [info] Elementor Pro/Upgrades - _on_each_version Finished 
2024-05-01 02:36:34 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.21.0',
  'to' => '3.21.2',
)]
2024-05-01 02:36:34 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.21.0',
  'to' => '3.21.2',
)]

PHP: showing 1 of 1PHP: 2024-04-14 05:44:15 [error X 1][../wp-content/plugins/elementor-pro/plugin.php::375] Uncaught Error: Class "ElementorPro\Core\Modules_Manager" not found in ../wp-content/plugins/elementor-pro/plugin.php:375
Stack trace:
#0 ../wp-includes/class-wp-hook.php(324): ElementorPro\Plugin->on_elementor_init('')
#1 ../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#2 ../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 ../wp-content/plugins/elementor/includes/plugin.php(658): do_action('elementor/init')
#4 ../wp-includes/class-wp-hook.php(324): Elementor\Plugin->init('')
#5 ../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#6 ../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#7 ../wp-settings.php(695): do_action('init')
#8 ../wp-config.php(64): require_once('/home/lgchd/pub...')
#9 ../wp-load.php(50): require_once('/home/lgchd/pub...')
#10 ../wp-blog-header.php(13): require_once('/home/lgchd/pub...')
#11 ../index.php(17): require('/home/lgchd/pub...')
#12 {main}
  thrown [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]



== Elementor - Compatibility Tag ==
	
	Elementor Pro: Compatibility not specified

== Elementor Pro - Compatibility Tag ==

Agreement

  • I agree that my issue may be closed without action if it doesn't meet all the requirements.
@wharminda wharminda added the status/awaiting_triage Indicates when an Issue, Pull Request, or Discussion awaits to be triaged. label May 2, 2024
@rob1998
Copy link

rob1998 commented May 14, 2024

We're still having the same issue on multiple sites, tried customer support last year in march with over 20 mails, including extensive troubleshooting, setting up dev environments, giving login credentials to Elementor team, etc.
Unfortunately, we still don't have a permanent fix. Regenerating CSS and replacing the HTTP for HTTPS URL using the Elementor's Replace URL tool fixes the issue, but the issue still returns after a while.
This would mean something has to go wrong at updates, or perhaps it has to do with the order of updates.

We had the issue for the menu and the icon list widget:
/wp-content/plugins/elementor-pro/assets/css/widget-nav-menu.min.css
/wp-content/plugins/elementor/assets/css/widget-icon-list.min.css

@wharminda
Copy link
Author

@rob1998 Yep, agreed. Something doesn't get updated. There's a simple fix that Ele could incorporate on their updates if they can't be bothered to fix the problem properly, just run the regen CSS tool twice on the completion of updates (they claim that it runs once at the end of the updates).

If you're feeling brave, instead of running the regen tool, try running the below in phpMyAdmin (do a backup of the website & db first), this would help prove this is the problem. If you're not familiar with MySQL/MariaDB, not worth it as your table prefix may not be the same, but if you do, post a comment here if it worked or not.

UPDATE wp_options
SET option_value = REPLACE(option_value, 'http', 'https')
WHERE option_name = '_elementor_assets_data';

@rob1998
Copy link

rob1998 commented May 14, 2024

Yeah, I wrote it into a snippet so we can batch execute it (also replaced http with http:, so it won't create httpss when replacing in url's that are already https):

<?php
// Include WordPress environment
require_once('wp-load.php');

// Ensure the script is not accessed directly
if (!defined('ABSPATH')) {
    exit;
}

// Get the global $wpdb object
global $wpdb;

// Define the query with dynamic table prefix
$table_name = $wpdb->prefix . 'options';
$query = $wpdb->prepare("
    UPDATE $table_name
    SET option_value = REPLACE(option_value, %s, %s)
    WHERE option_name = %s
", 'http:', 'https:', '_elementor_assets_data');

// Execute the query
$result = $wpdb->query($query);

// Check if the query was successful
if ($result !== false) {
    // Since we know it affects only one row or no rows, we check if rows_affected is 1
    if ($wpdb->rows_affected > 0) {
        echo "Update successful. 1 row updated.";
    } else {
        echo "No rows were updated.";
    }
} else {
    echo "Update failed.";
}
?>

@wharminda
Copy link
Author

Nice, thanks Rob.

A while back I did find some articles where people had added the regen CSS trigger to after update code, so on Ele update, the code ran. I can't remember the details of it, it needed WP Command Line installed, which I tried to do, but couldn't get working, so gave it up.

You may be able to add your code to the end of this and have it work on Ele updates without WP Command Line. I'm not a PHP dev, so will leave it to you. If you get it working, let me know how I can set it up. Thanks!

From https://wordpress.stackexchange.com/questions/414037/search-wordpress-hook-for-completed-elementor-update

Code Snippet 1
add_action('upgrader_process_complete', 'my_clear_elementor_cache');
function my_clear_elementor_cache()
{
// Make sure that Elementor loaded and the hook fired
if (did_action('elementor/loaded')) {
// Automatically purge and regenerate the Elementor CSS cache
\Elementor\Plugin::instance()->files_manager->clear_cache();
}
}

Code Snippet 2
function my_after_elementor_update_action( $upgrader_object, $options ) {
// Check if it's the update of the Elementor plugin
$elementor_plugin_slug = 'elementor/elementor.php';

if ( isset( $options['action'] ) && $options['action'] == 'update' && $options['type'] == 'plugin' ) {
foreach ( $options['plugins'] as $plugin ) {
if ( $plugin == $elementor_plugin_slug ) {
// Perform your action here after the Elementor plugin update
// For example, automatically purge and regenerate the Elementor CSS cache
if ( did_action( 'elementor/loaded' ) ) {
\Elementor\Plugin::instance()->files_manager->clear_cache();
}
break;
}
}
}
}

add_action( 'upgrader_process_complete', 'my_after_elementor_update_action', 10, 2 );

@rob1998
Copy link

rob1998 commented May 21, 2024

it's definitely possible to use a hook to run the script automatically after updating. However, that would be a dirty fix.
I ran the script on all our websites last week, checked that it replaced al the database values, but today there were again sites with the wrong asset url in the database.

@wharminda
Copy link
Author

@rob1998 Had another site with screwed up menu this morning, ran the SQL (added your : ) and it fixed the menu, so continuing to look like this is the problem.

Interesting that you have sites with http instead of https. Do these sites work OK? If so, there must be something specific in the way some are built, that they call https, can't find it, and fail, whereas some, perhaps, just call a URL eg /wp-content/elementor/somefile.css, rather than the fully qualified link of https://domain/wp-content/elementor/somefile.css which it can't find, because it's http://domain/wp-content/elementor/somefile.css in the database.

Not sure on your "dirty fix" comment, basically if it's broken and Ele refuse to fix it, then, if you want auto updates, the only option is some sort of dirty fix, especially on sites known to break.

@rob1998
Copy link

rob1998 commented May 22, 2024

@wharminda

Interesting that you have sites with http instead of https.

I don't have any http sites, it's just the 2 Elementor asset url's which are being stored as http in the database, which causes the issue because of CORS

If so, there must be something specific in the way some are built, that they call https, can't find it, and fail, whereas some, perhaps, just call a URL eg /wp-content/elementor/somefile.css, rather than the fully qualified link of https://domain/wp-content/elementor/somefile.css which it can't find, because it's http://domain/wp-content/elementor/somefile.css in the database.

I believe the frontend fileurl is being created like this: $frontend_file_url = ELEMENTOR_ASSETS_URL . 'css/' . $frontend_file_name;
ELEMENTOR_ASSETS_URL is defined as ELEMENTOR_URL . 'assets/' with ELEMENTOR_URL being plugins_url( '/', ELEMENTOR__FILE__ ). Where plugins_url is a concatenation of {get_option( 'site_url' )}/wp-content/{The folder of the plugin}

I'm looking through the entire source code to figure it out, but I haven't found a way to replicate the issue which makes it harder to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/awaiting_triage Indicates when an Issue, Pull Request, or Discussion awaits to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants