Getting Fatal error with WPML one feture

This topic has 26 replies, 3 voices, and was last updated 1 years, 9 months ago ago by Rose Tyler

  • Avatar: Olga Barlow
    Olga Barlow
    Support staff
    July 8, 2022 at 21:35

    Hello,

    Thank you. I passed your reply to WPML developers.

    Regards

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 15, 2022 at 09:56

    Hello,

    We got an answer from WPML company and found the solution for your case
    We added few lines code in Dashboard -> Snippets -> WPML fix content-product fatal error (snippet)
    Code below:

    add_action('woocommerce_before_template_part', function ($template_name) {
    if ( $template_name == 'loop/loop-start.php') {
    remove_all_filters('the_content');
    }
    }, 10, 1);

    Now if that snippet is enabled no fatal errors are shown on frontend
    https://prnt.sc/DPjQ-R8NcnxR

    Regards

    Avatar: DS
    DS
    Participant
    July 15, 2022 at 11:00

    Thanks for your help, yes it is fixed on the homepage now. But my other pages are not loading correctly. like URL given in the private contents area.

    I think all pages not loading properly where WooCommerce products are shown using shortcode.

    Please contact administrator
    for this information.
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 15, 2022 at 11:36

    Yes, you are right
    We improved our code on your staging site

    add_action('woocommerce_before_template_part', function ($template_name) {
    	if ( $template_name == 'loop/loop-start.php' || $template_name == 'loop/sale-flash.php') {
    		remove_all_filters('the_content');
    	}
    }, 10, 1);

    Regards

    Avatar: DS
    DS
    Participant
    July 15, 2022 at 11:41

    seems like it is fixed, can you please tell me what this code doing exactly so that I will note it.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    July 15, 2022 at 13:00

    Hello,

    1/ after we contacted WPML plugin they answered that they add some filters to the_content function
    2/ Our products show the_content in some cases
    3/ This code will remove all filters from ‘the_content’ (included the WPML one) just before content of product was loaded (or woocommerce products loop started )

    Regards

  • 1 2
    Viewing 26 results - 21 through 26 (of 26 total)

The issue related to '‘Getting Fatal error with WPML one feture’' has been successfully resolved, and the topic is now closed for further responses

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.