I am trying to put the_content() inside <meta itemprop="articleBody" content="(content here)">.

But if I just put <?php the_content() ?> in there, it doesn't work, image goes, structure gets mis-aligned, and "> appears after the content.

Any ideas?

Edit: I don't know why this was put on hold for not fitting in the Wordpress scope.. the_content() is a Wordpress function, I was clearly having trouble with structuring/SEO for my Wordpress site.


Use esc_attr() on data that is displayed in attributes, to prevent broken markup.

However it seems weird overall to use attribute to contain whole post.

| improve this answer | |
  • Suggested by schema.org and Google's WMT. – OJFord Jun 23 '13 at 14:31
  • Just tried your suggestion - does the same as htmlspecialchars(), it displays // before the content, and "> after it. And passes script to the meta. – OJFord Jun 23 '13 at 14:34
  • Is there some way I can auto-add the tag to the posts, rather than the PHP? So like, in the editor, when I publish there's automatically the first part at the beginning, then "> at the end? – OJFord Jun 23 '13 at 14:35

Fixed it by moving itemprop="articleBody" to the <div> containing the body.

| improve this answer | |

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