Support

Account

Home Forums Backend Issues (wp-admin) Adding new field to existing posts Reply To: Adding new field to existing posts

  • While Kevin’s suggestion will get done what you want to do, I find it a much better alternative to check fields in the template. For example, I would never add something like

    
    <span><?php the_field('my-field'); ?></span>
    

    without checking to see if it has a value first

    
    <?php 
      if (get_field('my-field')) {
        ?><span><?php the_field('my-field'); ?></span><?php 
      }
    ?>
    

    Since I’m already checking the value I would alter my check to:

    
    <?php 
      $value = get_field('my-field');
      if (!$value) {
        $value = 'my default value';
      }
    ?><span><?php echo $value; ?></span>
    

    This makes in unnecessary for me to retroactively add the field to the database.