Support

Account

Home Forums Backend Issues (wp-admin) Generating custom field values from other custom fields

Helping

Generating custom field values from other custom fields

  • Hello,

    i have 2 custom fields DaysOfTheWeek and IndividualDates, which a user can fill for a custom post type event. I want to achieve a meta query for dates and i need to create a sorted list of dates, when an event take place.

    My approach would be to generate this sorted date list by computing all date fields (above) to a new (user hidden) custom field as soon as a post is updated. Can you tell me how to create data for a new hidden custom field as soon as the post is updated, so that i can use these hidden custom field data in my query code?

    I only need to know how to create custom field data in the backend as a post gets updated.

    Thanks a lot!
    Kind regards

  • Hi @malv ,

    I believe you can hook into the acf/save_post filter. From here you can create or set the value for your hidden field.

    https://www.advancedcustomfields.com/resources/acfsave_post/

    Hope that helps.

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

You must be logged in to reply to this topic.