WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shortcode for my content. This shortcode organizes a couple of things in my posts on the frontend.

However, when I look at my feed, the content in the entirely leaves out any content from my shortcode and only starts after the shortcode content.

When I take the content outside of my shortcode it shows up in the

Why is my shortcode content not showing in the description of the feed? It worked great before I introduced the shortcode!

I have found a similar issue here with no resolution: http://wordpress.org/support/topic/execute-shortcodes-in-feed-content

Update: So I just read that shortcodes are being stripped by wordpress. How can I prevent this behaviour?

I have also tried this without any luck: the_excerpt and shortcodes

share|improve this question
up vote 2 down vote accepted

Ok I had to write my own custom excerpt like such:

function custom_excerpt($text = '') {
    $raw_excerpt = $text;
    if ( '' == $text ) {
        $text = get_the_content('');
                // $text = strip_shortcodes( $text );
        $text = do_shortcode( $text );
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
        $excerpt_length = apply_filters('excerpt_length', 200);
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
remove_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );
add_filter('get_the_excerpt', 'custom_excerpt');
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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