[wp-hackers] Select Menu to filter results by Custom Values

Jeremy Visser jeremy.visser at gmail.com
Sat Nov 22 12:58:26 GMT 2008


Check out the documentation for get_post_meta().
<http://codex.wordpress.org/Function_Reference/get_post_meta>

>From the article:

        If $single is set to false, or left blank, the function returns
        an array containing all values of the specified key.

Sounds like it would do exactly what you want.

So running this:

        $values = get_post_meta(23, 'some_key'); // $single defaults to false

If you had several values for the one key 'some_key', it should return
an array like this:

        $values = array(
        		'dead',
        		'beef',
        		'cafe'
        	);

Mind, I haven't actually tested what I've said. I haven't used
get_post_meta() in about a year, so I've probably forgotten it.

-- 
Jeremy Visser                                 http://jeremy.visser.name/

No Internet Censorship for Australia             http://nocleanfeed.com/



More information about the wp-hackers mailing list