Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

At the moment I am doing something like the following from inside the main loop;

$custom_values = get_post_custom_values('tenderfields');
$custom_values = unserialize($custom_values[0]);
$custom_values = $custom_values[0];

Then accessing them with $custom_values['my-custom-value']

This works fine but feels a little clunky, it feels like something there is probably already an internal call for that I am just missing?

I have looked through the docs and couldn't find anything.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

If you always need all of post meta at once this is the way to do it.

To access post meta for specific key use get_post_meta() that will retrieve value(s) and unserialize if needed.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.