I have a table (wp_postmeta), which contains four columns (meta_id, post_id, meta_key, meta_value). meta_key contains a field called neighborhood_value and the values for neighborhood_value are stored under the meta_value column. How do I retrieve the contents of neighborhood_value from my table and use them as a variable? Any support is appreciated
I have a table (wp_postmeta), which contains four columns (meta_id, post_id, meta_key, meta_value). meta_key
Share
Ok, as everything is meta, thecode will also be “meta” 🙂
UPDATE – now when I know what you use to connect to DB I can change my answer to be more specific.
The resulting $retMeta will be two dimensional array, and then you will be able to access your neighbourhood value by using $retMeta[‘neighbourhood_value’][0] (of course first you have to check if this is set –
isset($retMeta['neighbourhood_value'])).UPDATE2
For script imporing data, it’ll look like that:
But you should use WP_Query anyway, to maintain portability (the wp_postmeta doesn’t have to be named that way, it can be wp2_postmeta etc).