WordPress get_permalink() method is not working for facebook og:url

This is probably just some stupid mistake i’m making because of unfamiliarity with PHP.

//Lets add Open Graph Meta Info

function insert_fb_in_head() {
    global $post;
    echo '<meta property="og:url" 
        content="<?php echo get_permalink( 100 ); ?>" />';
}

Then, when I lint my website link using the FB linter tool, I get this error:

Read More

Object at URL ‘http://something.com/100/something/‘ of type ‘article’ is invalid because the given value

<?php echo get_permalink( 100 ); ?> 

for property ‘og:url’ could not be parsed as type ‘url’.

How am I using the WP function wrong? Thanks.

Related posts

Leave a Reply

1 comment