Meks
Do you know you can try any of our premium WordPress themes for free?Show me the themes
Change featured image alt tag in WordPress

Change featured image alt tag in WordPress

78Shares

Image alt tag (attribute) is useful because it describes your images and make users easier to find relevant content while searching on Google and other search engines.

If you run a WordPress website, you can of course add alt tags manually for each image but if you have a lot of content you will probably want an easy way to automatically set alt attributes at once. This particular example will show how you can change all your featured image (thumbnail) alt tags to its specific post title.

Introducing post_thumbnail_html WordPress filter hook

We are just using few lines of code in post_thumbnail_html WordPress filter hook. Note that your image alt tags won’t be physically changed in media library, the snippet will just modify HTML output on the frontend of your site.

That’s all folks! You just need to paste this snippet somewhere inside your theme functions.php file. Feel free to try and give us a feedback.

Top WP Hosting recommended by Meks
78Shares
Bojan Petrovic

Co-founder and WordPress developer at Meks. He has been involved in the business since 2009. creating themes, plugins and services on top of WordPress, continuously aiming to choose best approaches and work smarter, not harder.

Try theme now for free!
  • Access to a copy of the demo website
  • Full access to the theme options
  • No credit card required

* We will send you an occasional newsletter with special offers, news & theme updates but you can unsubscribe at any time.

Meks