WAIT: Listing custom post type items in dashboard fatal error

Browser: Safari 18.4
OS: macOS Ventura 13.7.5
Wordpress 6.8.1

I use a custom post type “Event”. Attempting to list created posts of this post type with Bricks enabled in the Wordpress dashboard breaks with fatal error on allowed memory size. I have pushed the WP memory size to 1 GB and PHP limit is 2 GB. All plugins disabled, except the one that creates the custom post type.

Switching to a different theme fixes the problem (even with much smaller memory size limits)

The custom post type is registered with the following parameters:

    [labels] => Array
        (
            [name] => Events
            [singular_name] => Event
            [menu_name] => Events
            [name_admin_bar] => Event
            [add_new] => Add New
            [add_new_item] => Add New Event
            [new_item] => New Event
            [edit_item] => Edit Event
            [view_item] => View Event
            [all_items] => All Events
            [search_items] => Search Events
            [parent_item_colon] => PPPParent Events:
            [not_found] => Nono Events found.
            [not_found_in_trash] => Nono Events found in Trash.
        )

    [public] => 1
    [rewrite] => Array
        (
            [slug] => hello_event
        )

    [has_archive] => 1
    [menu_position] => 20
    [menu_icon] => dashicons-carrot
    [show_in_rest] => 
    [taxonomies] => Array
        (
            [0] => post_tag
        )

    [supports] => Array
        (
            [0] => title
            [1] => editor
            [2] => thumbnail
            [3] => excerpt
        )

)

Additional info:
The problem does not appear if there is non-whitespace info in the post excerpt of all the items

Hi @christer and welcome to the forum :partying_face:.

Can you please explain how to replicate the issue? What I’ve done now, is to create the custom post type with the code (with the parameters that you posted), but now I’m not sure what you mean by that:

Please let me know, or record a video, and I’ll try to replicate it.

Thank you,
Matej

Hi Matej,
Thanks for your prompt reaction!
In the Wordpress dashboard you now have a menu item “Events”.
Create and publish one event and be sure to put some text in the excerpt.
Select All events in the Events menu. You will see the event just created in the list

Now modify the event and erase all text in the excerpt.
Select All events in the Events menu.
BANG:

Fatal error : Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /Users/christer/Sites/sardignac-on-wine-bricks/www/wp-includes/cache.php on line 154

Fatal error : Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /Users/christer/Sites/sardignac-on-wine-bricks/www/wp-includes/class-wp-fatal-error-handler.php on line 37

Hi @christer,

yep, that’s what I’ve tried.

Here is a list of all events - it’s only one.

And here is a content of that event, before I erased it:

Then I erased the excerpt text → updated the even → view the event list again, but it’s working.

Are you sure this is the only custom code that it’s running?

Hello Matej,
I have done some more investigations.
There are indeed some filter functions running and I have found where things break.
It is the following code line (in the custom plugin where the custom post type is defined)

apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );

When $post->post_excerpt returns an empty string this filter causes the problem when the Bricks theme is used.

I have tested switching to two different themes (2023 and Storefront) and with these things work OK.

Despite the fact that the problem only appears with Bricks, I suspect that the problem lies in the filter functions that may call each others recursively. I will look into this in detail, and if you don’t hear back from me, consider the problem solved.

1 Like

Thank you for the update! :slight_smile: If anything regarding Bricks comes up, let me know.

Thank you,
Matej