Using Shortcode in WordPress Post Excerpts

Shortcodes do not work in WordPress post excerpts by default, but you can easily make your post excerpts shortcode compatible by using the function described in this post.

Shortcodes were introduced in WP version 2.5 primarily for use in post content. They were not meant for post excerpts nevertheless you can easily add the shortcode capability to your post’s excerpts.

To add the shortcode functionality to WordPress excerpts , hook your custom function to ‘get_the_excerpt’ filter in following way:


The above code allows you to add your custom shortcodes into post excerpts. The code will work with all those excerpts which are manually added to posts.