ahmedkaludi / easy-table-of-contents

WordPress plugin which adds a user friendly and fully automatic way to create and display a table of contents from the page content.
http://connections-pro.com
67 stars 46 forks source link

Conflict issue with DIVI theme #749

Closed MohammedAkramU7 closed 3 months ago

MohammedAkramU7 commented 4 months ago

Ref ticket: https://magazine3.in/conversation/261031?folder_id=21

Description:- When we activate our plugin, the below error shows in the front-end post section.

Error:- Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 163840 bytes) in /home/jopadmin/public_html/1712237741154/wp-content/themes/Divi/includes/builder/class-et-builder-element.phpon line 20429

akshaywali commented 3 months ago

$this->post->post_content = apply_filters( 'the_content', strip_shortcodes( $this->post->post_content ) );

We were basically stripping shortcode before running the_content filter

But issue was the builder themes like Divi uses short codes for sections , rows and columns etc. , which were not getting stripped using strip_shortcodes.[Reason might be that this function removes only those short codes which are registered at the moment of the processing of this function]

But issue was the builder themes like Divi uses short codes for sections , rows and columns etc. , which were causing issue , our existing short code were complete stripping with its contents which we do not want.

So added a function stripShortcodesButKeepContent that will strips all issue causing Divi short codes but retains their inner content. Retaining inner content is important since all heading , textarea are inside the sections /rows or column

akshaywali commented 3 months ago

pushed in version 2.0.67