0

So there is a page with:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

  <?php  

     $desc= str_ireplace('"', '', trim(get_the_content()));

   ?>  

     <?php echo wpautop( $desc ); ?>

<?php endwhile; endif; ?> <!-- Pretty straightforward -->

When adding inline style in the editor:

<h4 style="background: rgba(222,222,222,0.5); padding: 5px;">Fill out the form with 
some info about your project and I will get back to you as soon as I can. Please allow 
a couple of days for me to respond.</h4>

I'm getting my desired results. But on the live site I get different results:

<h4 style="background:" rgba(222,222,222,0.5);="" padding:="" 5px;="">Fill out the form with some 
info about your project and I will get back to you as soon as I can. Please allow a couple of days 
for me to respond.</h4>

Any ideas what might be causing this?

Edit:

This is what is seen in the visual editior:

visual_editor although when inspecting the visual editor I can see that:

<h4 style="background: rgba(222,222,222,0.5); padding: 5px;" data-mce-style="background: 
rgba(222,222,222,0.5); padding: 5px;">Fill out the form with some info
about your project and I will get back to you as soon as I can. Please allow a couple
of days for me to respond.</h4>

data-mce-style gets added after the last double quote.

  • You seem to be explicitly stripping double quotes from HTML markup with double quotes there. I am not sure how it even works in one case. Are you certain exact same code is running in both environments? – Rarst Oct 9 '14 at 13:06
  • Oh. When inspecting the visual editor I can see that data-mce-style gets added after the inline style. But still, for what reason? – Laniakea Oct 9 '14 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.