I want to get my all posts-meta
, But on the base of key
. For example the main query for getting the post-meta is
<?php $meta_values = get_post_meta($post_id, $key, $single); ?>
Now i want to get this post-meta
on the base of key
only. My current query to get the post-meta is
<?php echo get_post_meta($post->ID, 'custom_tags'.$userID, true); ?>
And i want to remove $post->ID
from this query is there any way to get this. Thanks
$post->ID
is what makes the meta value distinguished across all posts with the same meta key.So if you want to shorthand the
get_post_meta
call for the current post you can do this:and you can call it like this:
Now if its not the current post but any post you can do this:
to get the first meta value of this key just call it like this:
and to get all meta values of this key use the
$limit
param ex:You can query your
postmeta
table directly using something like:fields
UPDATE
After you get your
$metas
, you pass them in a loop to display the values: