Home Forums General Issues Remove inline-style


Remove inline-style

  • Hi there,
    We are currently testing AMP for our custom post types. Unfortunately a lot of our texts have a <p style=”text-transform:justify”> in front of it. AMP does not allow any inline styling. We have about 240 entries so it would be a lot of work to undo/remove all of the inline-styles manually. Is there a possible to remove all “style=”text-transform:justify” within a <p>-tag?

    thanks a lot!

  • I solved it myself with the following code:

    $text = get_field('einleitungstext');
    $text = str_replace('<p style="text-align: justify;">', '<p>', $text);
    echo $text;
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Remove inline-style’ is closed to new replies.