So I followed the "Add Twitter Cards without plugins" this tutorial for how to add twitter metatags into the header using the wp_head method.

I have pretty much taken the code as is, and put it in my functions.php.

This works great for all the metatags except get_the_excerpt() which seems to just return nothing and so the metatag ends up looking like this:

<meta name="twitter:description" value="">

I thought that the line: global $post; meant that I should have access to all the post data in this code in the same way as if I was calling these functions in the loop.

Does anybody know why it isn't working? Or if there are better ways of doing it than this?

Any help is appreciated.



Your Answer

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

Browse other questions tagged or ask your own question.