Site logo

Archived topic

Element Admin Page Loading speed and crashing.

1 reply · Started by Adam on April 7, 2022

Viewing posts 1–2 of 2

Hi There,

Elements have started to crash and/or take forever to load.

I have a CPT called Companies which has 30,000+ posts.

So what is happening is whenever the display rule location is set to "Companies" this is when the problems happen, other post types work fine.

I believe it's trying to load/search all posts within "Companies". I don't need to define a specific post based on a post name so it just needs to be set to "All Companies".

It's strange because it has been working fine for a while with similar amounts of posts and only just started to happen. I've tried some debugging, disabling plugins for any conflict, purging cache, setting different caching rules etc for admin. Database clean, remove orphan and old metadata etc.

Assuming that might be the problem is there a way to disable this from loading or hard code the location? At the moment anything set to "Companies" is unusable including the Gutenberg editor.

Hi Adam,

You may bypass the Display rules through generate_element_display.

See: https://docs.generatepress.com/article/generate_element_display/

For instance, you can try something like:

add_filter( 'generate_element_display', function( $display, $element_id ) {
    if ( 392738 === $element_id && 'companies' === get_post_type() ) {
        $display = true;
    } else {
		$display = false;
	}

    return $display;
}, 10, 2 );

Kindly replace 392738 with the ID of your element and companies with your custom post type slug.

How to get the ID: https://share.getcloudapp.com/OAu66Z77

Tested this code on my site, specifically with a Block Element that has no display rules set and has a Headline Block “test no display rule” and seems to be working as expected: https://share.getcloudapp.com/qGu77b60

Hope this helps! Kindly let us know how it goes. :)

This archived topic is closed to new replies.