So i’d like to extract the image url from the database on one of my post_meta, but I’m unsure how to target that.
Here is the steps that I’m taking:
Here is what’s under the wp_postmeta
table in the database:
If I navigate to wp_posts
– I get the meta_value
post with my url inside as such:
When I do $test = get_post_meta($post->ID, 'full_image');
I get the following:
How does one extract the image url from wp_posts
based on $post->ID
? I’m having the hardest time targeting it.
UPDATE:
If I do var_dump(get_attached_media('image', $post->ID));
– I get the following results:
How do I grab the guid
url?
Advertisement
Answer
Got it working using this method:
$this->set_full_image(wp_get_attachment_image_url( get_post_meta($post->ID, 'full_image', true), 'large'));
The reason that I wasn’t getting any results back is because get_post_meta
was returning an array and not a single value so I had to set true at the end.