kylephillips / favorites

Simple and flexible favorite buttons for any WordPress post type.
https://favoriteposts.com
223 stars 86 forks source link

Out of memory issue when used inside a thrive theme #191

Open Toshiwoz opened 6 months ago

Toshiwoz commented 6 months ago

I have tested the plugin on a fresh installation, all works fine. But on my client's website, the list of user favorites throws an out of memory error: Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /home/hsd/techniques.hitsongsdeconstructed.com/wp-includes/formatting.php on line 236

It does not happen when used on a normal page.

Toshiwoz commented 6 months ago

I temporarily fixed it removing the apply_filter function, I'm pretty sure that is not the right solution but in the meantime this works for me.

This is the original code: https://github.com/kylephillips/favorites/blob/81cd10e6b317a679c7ff395319891103dfe8c67e/app/Entities/FavoriteList/FavoriteListingPresenter.php#L72-L79

This is my change:

    private function filterMarkup()
    {
        // $this->html .= apply_filters('the_content', $this->markup);
        $this->html .= $this->markup;
        $this->replacePostFields();
        $this->replaceFavoritesFields();
        $this->replaceThumbnails();
        $this->replaceCustomFields();
    }

Also, this comment might be useful, as other plugins had the same issue with thrive: https://wordpress.org/support/topic/toc-shortcode-doesnt-work-with-thrive-architect/#post-15906759