post meta – Check For get_post_meta on Author Archive Page
I’ve had a good look thru the Similar Questions for an answer and i’m looking to check if a value for a custom field key on single posts has been added using
get_post_meta(); however i want to use this check on the author archive page.
This is my code in functions.php
global $wp_query; $post = $wp_query->get_queried_object_id(); $meta = get_post_meta( $post->ID, 'key', true ); if ( $meta ) :
However, the code won’t work in the author.php template