Support

Account

Home Forums Add-ons Flexible Content Field Give flexible fields slug IDs automatically. Reply To: Give flexible fields slug IDs automatically.

  • @hube2 Thanks for the reply.
    Using that code, I’ve set this up:

    add_filter(
        "acf/fields/flexible_content/layout_title",
        function ($title, $field, $layout, $i) {
            $fieldId = $field["id"];
            return $title_value
                ? "<strong>$title</strong> - <small>#$fieldId</small>"
                : "<small>$title</small>";
        },
        10,
        4,
    );

    which shows the field ID (ie: field_61a5392dc9480) in the title bar, which is great.

    I’m wondering if there is a way to not have the whole field collapse when clicking on the title bar? I’d like to be able to allow the admin to click/double-click on that field ID to copy it, but clicking it just collapses the field.

    Also, found an issue where when you collapse and reopen the field group it erases the new title – like it is there til you collapse then it disappears. I read some forum posts asking how to fix this and I didn’t find anything that worked. Is this possible to fix? Maybe its an ajax issue?