Quantcast
Channel: WordPress.org Forums
Viewing all articles
Browse latest Browse all 46187

Andrew Scott on "Call custom field values in array of custom post type posts"

$
0
0

Two things are going on in your function that you'll want to fix. The first that $post doesn't exist in the function's scope. You're also including an unnecessary variable assignment when you fetch the post meta field. So, instead of this line:
$output.= $ad_url = get_post_meta($post->ID, 'ad-url', true);
Try this line:
$output.= get_post_meta(get_the_ID(), 'ad-url', true);


Viewing all articles
Browse latest Browse all 46187

Trending Articles