Meta tag with featured image's url? (4 posts)

  1. Teratoma
    Posted 3 years 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?


  2. Jerry
    Posted 3 years ago #

    Your not passing the attachment id to the function. Try this instead http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

  3. Jerry
    Posted 3 years ago #

    I hate typing on tablets, excuse my grammar plz

  4. Michael
    Forum Moderator
    Posted 3 years ago #

    with both of your examples, you would need to add echo into the code to get some output;


Topic Closed

This topic has been closed to new replies.

About this Topic