*

Own Petz

  • ****
  • 218 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Hi,

Thanks for your previous help.

I am using the Delta theme on Osclass and I want all external links posted by users to automatically include:

rel="nofollow ugc noopener noreferrer"

I have already added this attribute to the website link shown on the public user profile page, but users can still post URLs inside:

Listing descriptions


I cannot find the exact PHP file where these links are rendered, I have tried to ask with chatgpt but not able to fix the issue.


Please help me to fix this issue. (screenshot attached)
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 218 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
waiting for reply.
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

149health

  • ***
  • 51 posts
waiting for reply.
plugin description cleaner, or make new theme function :-X

*

MB Themes

Right Description Cleaner Plugin can help to reduce links in descriptions (and not just links, but also phone numbers etc).

Alternative is to build something by yourself, ideally using item_description filter.
https://docs.osclass-classifieds.com/filters-i119
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Own Petz

  • ****
  • 218 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
Ok thanks for reply.

I have checked this plugin, but in backend there is no option to add nofollow , because I don't want to convert all links into text.

I just want to add nofollow in links, I have checked in item.php, and also send item.php to chatgpt for help.. but not able to find the solution.

Could you please suggest me what to add in item.php so that all link in description field set to nofollow.

Thanks.
OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

Own Petz

  • ****
  • 218 posts
  • OwnPetz - Free Classified Ads. Buy, Sell or Adopt
I fixed this issue. Now all links showing nofollow in item description

Can you please check this code is correct

I have replaced this code

<div class="text">
  <?php echo osc_item_description(); ?>
</div>

with this

<div class="text">
<?php
$description = osc_item_description();

$description = preg_replace_callback(
    '/<a\s+([^>]+)>/i',
    function($matches) {
        if (stripos($matches[1], 'rel=') !== false) {
            return '<a ' . preg_replace(
                '/rel=["\']([^"\']*)["\']/i',
                'rel="$1 nofollow ugc noopener noreferrer"',
                $matches[1]
            ) . '>';
        }

        return '<a ' . $matches[1] . ' rel="nofollow ugc noopener noreferrer">';
    },
    $description
);

echo $description;
?>
</div>




OwnPetz - Free Classified Ads. Buy, Sell or Adopt Online. https://ownpetz.com

*

MB Themes

Good job ;)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots