Home>Support>Issue with the_content filter – WooCommerce Custom Product Tabs

Issue with the_content filter – WooCommerce Custom Product Tabs

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hello,

I am the developer of a plugin called Custom Product Tabs for WooCommerce (https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/). We received a support ticket this morning about compatibility issues with our plugin and the Page Builder plugin.

From the user’s point of view, this is what happens. If you use the Page Builder for a WooCommerce product’s main description (the_content), the content entered there will overwrite any of our custom product tabs content. For example, if you have a custom product tab with a string “this is a custom product tab,” and a description with “this is the description,” on the front end you will see “this is the description” for both the description tab and the custom product tab.

I looked into the code and the issue is that the Custom Product Tabs plugin is running our custom tab content through `the_content` filter. When this happens, the product’s description overwrites the custom product tab. To continue the previous example, before applying `the_content` filter, the tab content is “this is a custom product tab” and after applying `the_content` filter, the tab content is “this is the description.”

If I run the content through `the_content` filter without the Page Builder plugin everything works fine.

Please let me know if you have any advice,
Kevin.

 

Edit: I’m having issues with replying to my own thread so:

It seems like I’m having the problem described here: https://siteorigin.com/thread/page-builder-conflict-with-apply_filters-the_content/

136 add_filter( ‘the_content’, ‘wptexturize’ );
137 add_filter( ‘the_content’, ‘convert_smilies’, 20 );
138 add_filter( ‘the_content’, ‘wpautop’ );
139 add_filter( ‘the_content’, ‘shortcode_unautop’ );
140 add_filter( ‘the_content’, ‘prepend_attachment’ );
141 add_filter( ‘the_content’, ‘wp_make_content_images_responsive’ );

So if I use the above functions instead of using the_content filter, I should be good.

Let me know if I understood that correctly,
Thanks,
Kevin.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 5 months ago Alex S
    Hi, I Work Here

    Hi Kevin,

    This appears to priority issue. Try setting the priority to 11 to see if that resolves this issue. Let me know if that helps mate.

    It should, however, be noted that we’re going to change the priority of when we hook into the_content to 9 in an upcoming version (hopefully the next version) so please consider this a temporary if it does work.

    The linked thread actually seems to be related to a previous issue that’s since been fixed (at least according to the dev notes) – you previously had massive issues if you directly queried a post and applied the_content on it outside of the loop.

  2. 8 years, 5 months ago yikesitskevin

    Hi Alex,

    Thanks for the response. Forgive me if I am mistaken, but I am calling

    apply_filters( 'the_content', $my_custom_tab_content );

    and this call does not involve a priority.

    It may be a bit beyond your scope, but do you know if there’s a drawback (am I missing something) by replacing my the_content filter usage with the corresponding HTML-formatting functions if I am only using the_content filter to achieve HTML-Formatting / Shortcode parsing?

    apply_filters( 'the_content', $my_custom_tab_content );
    $content = function_exists( 'capital_P_dangit' ) ? capital_P_dangit( $content ) : $content;
    $content = function_exists( 'wptexturize' ) ? wptexturize( $content ) : $content;
    $content = function_exists( 'convert_smilies' ) ? convert_smilies( $content ) : $content;
    $content = function_exists( 'wpautop' ) ? wpautop( $content ) : $content;
    $content = function_exists( 'shortcode_unautop' ) ? shortcode_unautop( $content ) : $content;
    $content = function_exists( 'prepend_attachment' ) ? prepend_attachment( $content ) : $content;
    $content = function_exists( 'wp_make_content_images_responsive' ) ? wp_make_content_images_responsive( $content ) : $content;

    Any insight would be greatly appreciated,
    Kevin.

  3. 8 years, 5 months ago Alex S
    Hi, I Work Here

    Hi Kevin,

    Oh. My mistake – I thought you were doing it slightly differently. The only thing that comes to mind with doing it that way is if a user has a plugin installed that makes further modifications to the_content and said modifications are actually desired. Outside of that, I don’t see any real issue – although it’s not the neatest solution.

    Maybe consider removing our filter (siteorigin_panels_filter_content) temporarily and running your code. Then reapply it once you’re done. That will likely avoid any possible chanc of a desired function not being applied.

  4. 8 years, 5 months ago yikesitskevin

    Hi Alex,

    Thanks a lot. I will use remove your filter and re-add it; that works.

    Kevin.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More