Forum

Thread tagged as: Question, Problem

Is it possible to remove tags using the replace feature?

I'm trying to remove the <p> tags from content generated by redactor. Basically I want a string of text without the opening and closing <p> tags automatically added by redactor.

I don't want the user to have to choose a format type as the text is being output into an existing tag.

replace="<p>|"

Doesn't work as it closes the content tag early.

Is this possible in anyway?

Tony Astley

Tony Astley 0 points

  • 3 years ago

In the end I passed the whole region into a php variable and used string replace.

$banners = perch_content_custom('Page Banners', array(
        'template' => 'banners/page_banner.html',
    ), true);

    $naughty = ["<p>", "</p>"];
    $nice   = ["", ""];

echo str_replace($naughty,$nice,$banners);