I put the caption on a picture like this, the blog looks good,

enter image description here

but in the compact view, I receive this problem

enter image description here

I guess the editor can not read the HTML tag, Is anyone know what happened? enter image description here

  • Can you describe what you mean by compact view? Where are your screenshots from? What are they of? – Tom J Nowell Nov 27 '18 at 3:18
  • That error from my company blog, it means I create a post and when I move to the website, I got an error like the second picture. – baonhg Nov 27 '18 at 8:18
  • But how is it being displayed? Is that a widget? Where is the code that displays that content on the frontend? – Tom J Nowell Nov 27 '18 at 16:54

That's not an HTML tag, it's a shortcode. If your theme used the the_excerpt() function for displaying the 'compact version' of the post content then this wouldn't appear. WordPress strips shortcodes out of post excerpts to prevent this happening.

If your theme is using its own method for generating the excerpt then its developer needs to fix the theme so that excerpts properly remove shortcodes. This can be achieved with the strip_shortcodes() function.

| improve this answer | |
  • I fixed it simply by deleting the caption attribute of the picture. Also, I recommend this to our Wordpress Dev, thank for your help. – baonhg Nov 28 '18 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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