0

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.

<wp:postmeta>
    <wp:meta_key><![CDATA[_dt_post_settings]]></wp:meta_key>
    <wp:meta_value><![CDATA[a:3:{s:6:"layout";s:18:"with-right-sidebar";s:27:"show-standard-sidebar-right";s:4:"true";s:19:"show-featured-image";s:4:"true";}]]></wp:meta_value>
</wp:postmeta>
0

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);
      endforeach; 
   }
|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.