Support

Account

Home Forums Backend Issues (wp-admin) grouped and none-grouped fields

Helping

grouped and none-grouped fields

  • Hey guys,

    Yesterday I had an issue with the way fields are named when grouped or not.
    It might be something that should have been obvious but to me it was a first running into this issue.

    I am currently in a transition stage from the free Advanced Custom Fields to the Pro version.
    And though we are not actively going through all the fields to change them where necessary, we do change them so they are grouped and neatly layed out on the page editor page.

    Now here is the issue.
    I made a field of the type group called “hero
    This group was meant to replace a field set also called “hero

    In the old group I had multiple fields of which I will name 2 below (to make the issue clearer).

    Fieldset: Hero – old
    -> hero_title (type: text)
    -> hero_subtitle (type: text)

    So then I made a new fieldset like this.

    Fieldset: Hero – new
    -> hero (type: group)
    -> title (type: text)
    -> subtitle (type: text)

    Again this is just a part of the full fieldsets but you get the point.

    Now the thing that happend was this.
    When I added the new fieldset, it was added to the top of the fieldset order on the page editor screen.
    When I tried to save the new title and subtitle, they wouldn’t save.
    I tried to debug the php and found that wordpress indeed failed to save the values I entered.

    After much trail and error and a not so good night of sleep…. I was looking in the documentation and the database for the fields in question.
    That’s when I noticed that in the database ACF knows what fields are there and what fieldset and or group they belong to.
    But when it is saved, the field inside the “hero” group is saved as “hero_title” and the same for the subtitle. Which means that it is also saved as “hero_subtitle”

    With this knowlede I tried changing the order of the fieldsets in the page editor screen.
    This worked and now the old fields are overwritten.

    Is this a bug or a thing that was always there and it was just coincidence that I stumbed on this now?

    Cheers.

  • Hey guys,

    Yesterday I had an issue with the way fields are named when grouped or not.
    It might be something that should have been obvious but to me it was a first running into this issue.

    I am currently in a transition stage from the free Advanced Custom Fields to the Pro version.
    And though we are not actively going through all the fields to change them where necessary, we do change them so they are grouped and neatly layed out on the page editor page.

    Now here is the issue.
    I made a field of the type group called “hero
    This group was meant to replace a field set also called “hero

    In the old group I had multiple fields of which I will name 2 below (to make the issue clearer).

    Fieldset: Hero – old
    -> hero_title (type: text)
    -> hero_subtitle (type: text)

    So then I made a new fieldset like this.

    Fieldset: Hero – new
    -> hero (type: group)
    -> title (type: text)
    -> subtitle (type: text)

    Again this is just a part of the full fieldsets but you get the point.

    Now the thing that happend was this.
    When I added the new fieldset, it was added to the top of the fieldset order on the page editor screen.
    When I tried to save the new title and subtitle, they wouldn’t save.
    I tried to debug the php and found that wordpress indeed failed to save the values I entered.

    After much trail and error and a not so good night of sleep…. I was looking in the documentation and the database for the fields in question.
    That’s when I noticed that in the database ACF knows what fields are there and what fieldset and or group they belong to.
    But when it is saved, the field inside the “hero” group is saved as “hero_title” and the same for the subtitle. Which means that it is also saved as “hero_subtitle”

    With this knowlede I tried changing the order of the fieldsets in the page editor screen.
    This worked and now the old fields are overwritten.

    Is this a bug or a thing that was always there and it was just coincidence that I stumbed on this now?

    Cheers.

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

The topic ‘grouped and none-grouped fields’ is closed to new replies.