get_the_excerpt not working in header
-
I am using the code below to add FB Open Graph Meta Tags (trimmed to just show the description line. It all works apart from the description, which returns a blank string from the ‘get_the_excerpt()’.
//Lets add Open Graph Meta Info function insert_fb_in_head() { global $post; if ( !is_singular()) //if it is not a post or a page return; echo '<meta property="og:description" content="' .get_the_excerpt(). '"/>'; } add_action( 'wp_head', 'insert_fb_in_head', 5 );
Has anyone come across this before? Any help would be greatly appreciated.
Thanks
Jamie
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_the_excerpt not working in header’ is closed to new replies.