How can I order the custom field in admin instead of drag and drop
-
I want to order custom fields in admin. It doesn’t work with drag and drop, and I was thinking of creating a code for this.
Hi, I started a sutom code in the functions.php file.
But I couldn’t get it to work
Do you have any idea how to make it work?
Thank you
function reordoneaza_acf_group($group_id, $new_order) { // Make sure ACF is enabled if (!function_exists('acf_update_field_group')) { return; } // Get the current fieldgroup $group = acf_get_field_group($group_id); // Checks if the group exists and has fields if (!$group || empty($group['fields'])) { return; } // Update the order of the fields in the group $group['fields'] = $new_order; // Update the field group with the new order acf_update_field_group($group); return true; } $group_id = 'group_6537b665691a9'; // Replace with your ACF field group ID $new_order = array( 'field_6537b66644bc6', 'field_6537b66d44bc7', 'field_6537b67144bc8' ); // Replace with field keys in desired order reordoneaza_acf_group($group_id, $new_order);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How can I order the custom field in admin instead of drag and drop’ is closed to new replies.