WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hi I am working on a site that has over 1500 posts. Many of those posts are in the gallery post format, but I need to change them to the "Standard" format to work with the clients current theme.

Is there any way I can automate this? enter image description here

share|improve this question
  • Back-up your db
  • Add this code to your functions.php file from your theme:

    $all_posts = get_posts(array(
      'numberposts' => -1,
      'post_type'   => 'post',
    foreach($all_posts as $p)
      set_post_format($p->ID, 'standard');
  • Refresh
  • Remove the code

Or with a SQL command:

UPDATE `term_relationships`
  SET term_taxonomy_id = 'standard_post_format_id'
  WHERE term_taxonomy_id = 'gallery_post_format_id'

Change standard_post_format_id and gallery_post_format_id with the IDs matching post format names from the term_taxonomy/terms tables

share|improve this answer

Your Answer


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.