0

function theme_slug_filter_the_content( $content ) {
 // Define the attribute you want to remove
$attribute = 'rel';
 // Regular expression pattern to match and remove the attribute
$pattern = '/(<a\s+[^>]*)(\b' . preg_quote($attribute, '/') . '="[^"]*")([^>]*>)/i';
 // Replace the matched pattern with the tag excluding the attribute
$content = preg_replace($pattern, '$1$3', $content);
  //     $custom_content = 'YOUR CONTENT GOES HERE';
//     $custom_content .= $content;
    return $content;
}
add_filter( 'the_content', 'theme_slug_filter_the_content', 999999);

Jagdish Sarma Asked question March 2, 2024
Add a Comment