• Resolved andrew124

    (@andrew124)


    I have an online marketplace powered by WooCommerce and need to prevent vendors from adding links to their websites or Etsy URLs in the product descriptions.

    Is there a way to filter out external links in the product description and short description?

    * Used the plugin Real-Time Find & Replace to filter out Etsy links in real-time, but this doesn’t resolve it when vendors link to other channels or their website in the product description.

    * Need to keep HTML available for shortcodes or other features. Just need to filter out external links only.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter andrew124

    (@andrew124)

    Update: I just found this filter for functions.php in WordPress posts. So it would be something link this, but for WooCommerce descriptions and short descriptions:

    `add_filter( ‘the_content’, ‘filter_the_content_in_the_main_loop’ );

    function filter_the_content_in_the_main_loop( $content ) {

    if ( is_single() ) {
    $content = preg_replace(array(‘”<a>”‘, ‘”</a>”‘), array(”,”), $content);
    }

    return $content;
    }`

    • This reply was modified 3 years, 11 months ago by andrew124.
    Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to remove external links in the product description’ is closed to new replies.