• Resolved mmwbadmin

    (@mmwbadmin)


    Hi,
    if an Image Caption is within the first n words of a post, it is included in the Excerpt (of n words). Didn’t use to be before Gutenberg.
    In my case the Post ‘Letland saneert bankensector wel’ is shown on the frontpage as excerpt, but contains the caption ‘ Letse Centrale Bank in Riga ‘.
    The full post is at https://www.mmwb.nl/letland-saneert-bankensector-wel/

    Please advice

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

Viewing 1 replies (of 1 total)
  • Hi! Unfortunately I don’t have a solution for you can, but I can note that this issue has been reported in GitHub where the following reply was posted:

    Comment by Otto42:

    This is because wp_trim_excerpt() in core does not know about Gutenberg yet.

    In WordPress 4.9, the editor creates images by using the caption shortcode. Content it creates will look like this (shortened for brevity):

    [caption id= ... ] Caption here[/caption]

    In Gutenberg, images created by the image or gallery blocks look like this:

    
    <figure class= ... ><img src="..." /><figcaption>Caption here</figcaption></figure>
    

    The wp_trim_excerpt function in core generates the automatic excerpt from content. It calls the strip_shortcodes() function on that content at one point. The old way has shortcodes for captions, the new way does not.

    So, this is really more of a problem that will need to be addressed in core when Gutenberg is merged.

    • This reply was modified 6 years, 5 months ago by Anne K..
    • This reply was modified 6 years, 5 months ago by Jan Dembowski. Reason: Fixed formatting
Viewing 1 replies (of 1 total)
  • The topic ‘Image Caption is included in Excerpt’ is closed to new replies.