Ok, this is actually about the output as you said in your comment.
I suppose you know, you can do modification like this:
// assumed a single result is returned as string
$your_post_meta = get_post_meta( get_the_ID(), 'your_post_meta', true );
// lets add something
$your_modified_post_meta="My post meta: " . $your_post_meta;
So far so obvious I would say – depending on the return value might be an array you can do pretty much any modification possible for the type of data, but that would be a different likely PHP heavy topic.
Of course you are actually asking about a hook that can be used to do such things. To retrieve your post meta you are using get_post_meta()
– source – I assume, which is a wrapper for get_metadata()
– source. Inside get_metadata()
we find the filter hook get_{$meta_type}_metadata
– source – it is variable, depending on the $meta_type
, which means for post meta(s) it is get_post_metadata
.
It can be used like this:
add_filter(
'get_post_metadata',
'wpse162923_change_post_meta_out'
);
function wpse162923_change_post_meta_out(
$check,
$object_id,
$meta_key,
$single
) {
if ( $meta_key == 'your_post_meta' ) {
$your_post_meta = get_post_meta(
$object_id,
'your_post_meta',
$single
);
$check =
'My post meta: '
. $your_post_meta;
}
return $check;
}
Note: the above is just exemplary, so make it fit to your needs.