Home Forums Backend Issues (wp-admin) Reorder ACF Groups (per page basis) Reply To: Reorder ACF Groups (per page basis)

  • It could be possible to set this on a per page basis. I do not have any code, just a vague outline.

    The main issue that I have found it that the meta box order is saved with AJAX as the user moves the boxes around. If I had to do this I would.

    This is just for pages, it would need to be duplicated for other edit page box orders.

    1. Create an acf/save_post action
    2. Get the user option
      $user = get_current_user_id();
      $order = get_user_option("meta-box-order_page", $user)
    3. Create a new option that included the post ID
      update_user_meta($user, "meta-box-order_page-$post_id", $order);
    4. Add a filter on get_user_option_meta-box-order_page like @piotku posted
      add_filter('get_user_option_meta-box-order_page', 'meta_box_order_by_page', 10, 3);
    5. In that filter get and return the users meta data saved for the current post ID

    The main issue that I see with this is getting the current post ID because I don’t know if that information will be available or how it would be available. Potentially global $post might be set.