WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Teratoma
    Member
    Posted 1 year 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?

    Thanks!

  2. Jerry
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    I hate typing on tablets, excuse my grammar plz

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_url

Topic Closed

This topic has been closed to new replies.

About this Topic