Unable to fetch data using Meta key
-
I wanted to show user data of author of custom post using meta key using below code but this sin’t working, I checked and i didn’t able to find any meta_key data stored for user. but it showing in update profile page
function get_author_address() { global $post; $author_id = $post->post_author; // Get the author ID $address = get_user_meta($author_id, 'address', true); // Get the 'address' meta_key if (!empty($address)) { return $address; } else { return 'No address found for this author.'; }echo $address; } add_shortcode('author_address', 'get_author_address');
- The topic ‘Unable to fetch data using Meta key’ is closed to new replies.