esc_attr not working in shortcode

Question

I have a shortcode that outputs a block of html. One element in the block is an anchor tag with an image caption in the title attribute. Some of the captions I am using have double quotes in them, so I am wrapping them in esc_attr(), but none of the quotes are being encoded. If I put an echo statement in the shortcode with esc_attr() around the caption, it outputs an encoded string, but it doesn’t seem to work when I return the html as you are supposed to do in a shortcode. Is this the nature of esc_attr()? If so, how can I encode a string to be returned from a shortcode?

0
, jncoates 7 years 2014-02-28T22:11:22-05:00 0 Answers 86 views 0

Leave an answer

Browse
Browse