Support

Account

Home Forums ACF PRO Updating existing fields

Solving

Updating existing fields

  • Hi friends-
    I can’t believe I’ve gotten this far without registering for the forum yet. Speaks to the excellent documentation and help here on the forum. Thank you all.

    I’ve built a bunch of layouts in a flexible content field that acts as a modular page builder.
    – I would like to add a field to existing layouts that are already in use.
    – New instances of the layout show the new field, but existing ones (on the site with content in them) do not.

    How do I update existing content to show my new fields? I hope that makes sense.

    Thanks a ton
    -mat

    (if you care, the field is a radio button that adds a class to make the content area narrower-60%)

  • There really isn’t an efficient way to add values retroactively to existing posts… other than edit and update every post where the new fields are used.

    The best way to deal with adding new fields is to assume a default value in your code when they are not set.

    Simple example:

    
    $value = get_field('my-field');
    if (!$value) {
      $value = 'default value';
    }
    
  • OK, too bad.
    Thank you.
    And very helpful snippet there, thank you again.

    Best
    -mat

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Updating existing fields’ is closed to new replies.