Skip Navigation

[Closed] override_local_post_meta_value causing significant performance degradation

This support ticket is created 2 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 2 years, 5 months ago.

Assisted by: Nigel.

Author
Posts
#2552997
2023-02-12_209961_plugins.png

This site appears fast thanks to CloudFlare caching, but that does not assist logged in users who are burdened with 4-5 second page load times. Code Profiler (https://wordpress.org/plugins/code-profiler/), has suggested that Toolset is the cause, and most particularly that Toolset_Theme_Integration_Settings_Front_End_Controller::override_local_post_meta_value() is taking an inordinate amount of time (2.24s of that page load time).

Note that 2.24s is 4x higher than the next longest-running function in the list. That seems inordinate, but I do not know enough about Toolset internals to understand the purpose of that function or whether there is some way in which it could be further optimized (or what effect bypassing it might have).

Any ideas?

wp-views	Toolset_Theme_Integration_Settings_Front_End_Controller->override_local_post_meta_value	2.24162	1	/var/www/html/wp-content/plugins/wp-views/vendor/toolset/toolset-theme-settings/compatibility-modules/controllers/toolset-theme-integration-settings-front-end-controller.php	/var/www/html/wp-includes/class-wp-hook.php@310	Toolset Views	plugin

astra-addon	Astra_Ext_Nav_Menu_Loader::get_megamenu_default	0.57529	17	/var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-loader.php	/var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@182, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@183, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@184, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@185, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@186, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@187, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@188, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@189, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@190, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@191, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-ext-nav-menu-markup.php@199, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@224, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@230, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@232, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@264, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@271, /var/www/html/wp-content/plugins/astra-addon/addons/nav-menu/classes/class-astra-custom-nav-walker.php@281	Astra Pro

WPCF_Loader::wpcf_cache_complete_postmeta	0.313221	1	/var/www/html/wp-content/plugins/types/vendor/toolset/types/embedded/classes/loader.php	/var/www/html/wp-includes/class-wp-hook.php@310	Toolset Types	plugin																									
a3-lazy-load	Composer\Autoload\ClassLoader->findFile	0.185823	1	/var/www/html/wp-content/plugins/a3-lazy-load/vendor/composer/ClassLoader.php	/var/www/html/wp-content/plugins/a3-lazy-load/vendor/composer/ClassLoader.php@321	a3 Lazy Load	plugin																																												
#2553641

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

I can see that there are quite a few calls made to that function on my own local test site, and depending on the complexity of the page or post being viewed, and what's on the page, they could add up.

The functionality relates to Toolset's integration with theme options for supported themes like Astra (which it seems you are using), where—if you have a Content Template for some content type—you can override the general theme settings for posts that use the template.

It works by intercepting the calls to get_postmeta on the page, and while some optimisation may be possible, I'm not sure a different approach is readily possible.

But maybe you are not using this feature?

If that's the case it may be that I can help disable it on your site.

I suggest you edit this plugin file directly and comment out these two lines (which should be lines 43 and 44): plugins/toolset-blocks/vendor/toolset/toolset-theme-settings/compatibility-modules/controllers/toolset-theme-integration-settings-front-end-controller.php

		add_filter( "get_post_metadata", array( $this, 'override_local_post_meta_value'), 5, 4 ) ;
		add_filter( "get_post_metadata", array( $this, 'get_settings_for_layout_or_ct_passed_from_url'), 10, 4 ) ;

Test that with your code profiler. Does it make a difference?

If so I'll see if it is possible to achieve the same without editing the plugin files.

#2554329

Thanks. Tried that, which revealed that the problem may be further up the stack, because removing those calls did not significantly change it but just bumped the problematic ones up to "Astra_Ext_Nav_Menu_Loader::get_megamenu_default" and "Elementor\Controls_Stack->is_control_visible" (which was, in fact, hitting that filter function a large number of times).

So likely, the filter isn't "slow" - but it is being called a huge amount of times....

Was worth a shot!

#2554831

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

I don't have access to the details you have, but it sounds like that succeeded in removing the Views theme integration as a source of the problem, and next you have problems with Astra and Elementor to look into.

I'm checking with the developers about removing those filter calls without editing the plugin file; they are added in such a way that it is difficult to remove them, and I'm awaiting clarification.

I'll get back to you when I have feedback from them.

#2555097

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

OK, assuming you are not using the theme integration you can disable that section of code entirely by adding the following to your theme's functions.php file:

add_action( 'after_setup_theme', 'tssupp_disable_toolset_theme_settings', 0 );
function tssupp_disable_toolset_theme_settings() {
    remove_action( 'after_setup_theme', 'toolset_run_theme_settings', 2 );
}

That will eliminate Toolset theme options as a source of delay on page loading, and you can then focus on anything else that is causing similar problems.

The topic ‘[Closed] override_local_post_meta_value causing significant performance degradation’ is closed to new replies.