Support

Account

Home Forums Add-ons Repeater Field Moving Repeater Field Values from another Repeater Field and vice versa Reply To: Moving Repeater Field Values from another Repeater Field and vice versa

  • First of all, you cannot just create 2 options pages with the same fields. If the fields are named the same then they will actually be the same fields. Any update on one options page will update the other options page as well. Using the default post_id of “options” all values are stored in the options table with the field names you use.

    There are 2 choices for a solution to the above. The first is to use different field names for each options page and the second is to use different post ID values for each options page.

    Second, is it possible to move them? You’d have to create some type of a field to indicate that they will be moved. Then you will need to create an acf/save_post action to do the work.

    With that solved then, yes it would be possible.
    For the most part all I can do is give you pseudocode.

    
    add_action('acf/save_post', 'move_values', 20);
    function move_values($post_id') {
      // check post id to see if it is one of your options pages if not then return
      // see if values should be moved, if not then return
      // test to see which page is being saved
      // get the values from the options page being updated
      // update the fields on the options page you want to move them to
      // delete the values from the options page being saved
    }