post meta – Check For get_post_meta on Author Archive Page
Question
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
0
1 year
2022-02-10T01:06:40-05:00
2022-02-10T01:06:40-05:00 0 Answers
0 views
0
Leave an answer