treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Remove/Edit Img classes in Wordpress

  • So Wordpress is outputting this
    <img src="http://site.com/path/to/image.png&quot; alt="Text"  width="600" height="100" class="alignnone size-full wp-image-168" />


    However, I would like it to output this
    <img src="http://site.com/path/to/image.png&quot; alt="Text"  width="600" height="100" class="full wp-image-168" />


    Removing the align class and removing the size- part.

    How can I go about this via a filter in the functions.php file?
  • I'd suggest just changing your CSS to use these classes as it's going to be a lot easier.
  • However I'd rather not delete and edit those classes every time I insert an image.
  • I think @betzster has a point here - any reason you can't just use the classes that WP is outputting?
  • @TheDoc As you are aware, Wordpress outputs a ridiculous amount of classes. I believe this is because for the majority of people it allows for more targeting. That doesn't mean it's necessary for everyone. Therefore, I have removed the output of the classes for the menu and now I am trying to rid it from images. I'm not saying I can't use them, but I prefer to markup my site the best way that works for me.