I have a bunch of blog posts that I need to update with a custom postmeta key/value pair. Therefore I have two questions - where can I find the postmeta entries in a worpdress MySQL database and how can I update all blog posts and add the following postmeta key value pair to them.


Post meta entries are in your wordpress database, in the wp_postmeta table.

I am just a newbie, not sure if this is right, but something I can think of that might help you in the right direction. Hope this helps.

function wordpress_custom_post_meta_bulk()
      $posts = get_posts(array('numberposts' => -1) );
      foreach($posts as $p) :  
         $meta += array('_key' => '';
                        '_value' => '';);
         update_post_meta($p->ID, 'meta',true);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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