• Resolved Gal Baras

    (@galbaras)


    The page contains the shortcode “[testimonials category=’personal-life-coaching’]”, which produces a nice list of testimonials. However, when the excerpt is created for the page, the shortcode is just skipped.

    The excerpt of the page is being copied into its meta description tag by Yoast SEO.

    Is it possible that the Easy Testimonials ‘get_the_excerpt’ filters are causing this?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor richardgabriel

    (@richardgabriel)

    Hey @galbaras!

    Thanks for using our plugin!

    Am I understanding right that when you view the excerpt of the linked page, you see the Testimonials shortcode instead of the Testimonials content?

    If I understand correctly, this is because WordPress won’t render shortcodes (or HTML tags) inside excerpts, per the following:

    https://developer.ww.wp.xz.cn/reference/functions/the_excerpt/

    An auto-generated excerpt will also have all shortcodes and tags removed. It is trimmed down to a word-boundary and the default length is 55 words. For languages in which words are (or can be) described with single characters (ie. East-Asian languages) the word-boundary is actually the character.

    Does that sound like what is happening to you? If so, this is normal WordPress behavior.

    Please let me know if that helps!

    All the best,
    Richard

    Plugin Contributor richardgabriel

    (@richardgabriel)

    Hey @galbaras!

    I just wanted to touch base and see if my above reply was helpful?

    All the best,
    Richard

    Thread Starter Gal Baras

    (@galbaras)

    Hey Richard,

    Yes and no. Although this is the default behavior for WordPress, specific shortcodes can be excluded from being stripped out via the strip_shortcodes_tagnames filter (for excerpts) and the wpseo_replacements filter (for Yoast SEO).

    I’ve already worked this out for my sites, but if Easy Testimonials had this code as part of the plugin, that would save non-programmers heaps of hassles, I think.

    To make this super compatible, this can be a plugin setting that’s turned off by default, with an explanation of what it does.

    If anyone is interested in my code, please see https://gist.github.com/galbaras/f1d1911822091571beb9adbc81cacc80

    Cheers,
    Gal

    Plugin Contributor richardgabriel

    (@richardgabriel)

    Hey @galbaras!

    Thanks for the update and for the code and suggestion!

    I’ll be sure to note this on our tracker to look at in a future update!

    All the best,
    Richard

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Shortcode not expanded in page excerpt’ is closed to new replies.