Support » Plugins and Hacks » Hacks » Meta tag with featured image's url?
4 years, 8 months ago
I’m trying to put a meta tag in my header that will pull the featured image’s url from a post.
Why can’t I get this to work? Here’s my code:
<meta name="my_meta" content="<?php wp_get_attachment_url();?>"/>
I’ve tried all kinds of things but I’m still pretty noobish here. For instance,
<meta name="twitter:image" content="<?php get_permalink();?>"/>
works just fine as far as the formatting and syntax goes. How can I stick the featured image’s URL in there instead?
Your not passing the attachment id to the function. Try this instead http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
I hate typing on tablets, excuse my grammar plz
with both of your examples, you would need to add echo into the code to get some output;