I am working with a wordpress theme that is using Foundationpress as it's starter theme. When I use the_content() all img tags have there css class replaced with image. This is overwriting the ability for the editors to use there own classes.

While debugging if I die(get_the_content()) I see the original classes. I have been going through the entire project trying to find where that logic could be overwriting these classes. Has anyone seen this before ?

So far i have checked:

  1. Functions.php
  2. All javascript
  3. Library directory that comes with foundationpress.

Anywhere I could be overlooking?


It's unusual for the_content to be rewriting image classes like this; it sounds like it could be a plugin (or theme function) which is doing this. Have you disabled all plugins just to check?

Having said that, most of the functions in core that hook into the_content are located in wp-includes/default-filters.php (apart from the oembed functions).

You can remove any of them by adding the following to your theme's functions.php, eg. to remove the wpautop function:

remove_filter("the_content", "wpautop");

However none of these should be messing with these classes. The wp_make_content_images_responsive function will be messing with image tags, but it should only be checking the classes, not changing them, which is why it sounds like these changes could be happening in a plugin.

  • 1
    Turned out to be a plugin. Responsive Post images – jackncoke May 3 '16 at 21:11
  • Glad you found it! I'm not familiar with that plugin, but WP supports responsive images out of the box now so it may no longer be needed? – Tim Malone May 3 '16 at 21:13

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.