Support

Account

Home Forums Backend Issues (wp-admin) update default values when template or parent page is changed

Helping

update default values when template or parent page is changed

  • I am using flexible content with various layouts, and wanted to have specific blank layouts set up by default when a new post is created. The specific layout would depend on post type, template, parent, or ID.

    Using the answer here, I’ve been able to do that and it works great: https://support.advancedcustomfields.com/forums/topic/flexible-content-appear-automatically/

    The issue I have now is that since I want to use post parent & template as a condition on what default fields to show, I want to refresh the value of the flexible content field when this happens without needing to refresh the page. Similar to how ACF hides & shows relevant fields as applicable when these are changed.

    Is there a way I can hook into when ACF refreshes the fields so I can also refresh my default values for the flexible content field?

  • You would need to look at the ACF JS API https://www.advancedcustomfields.com/resources/javascript-api/. There is probably an action that fires for this, but you’d need to populate all of the content in the flex field using JS rather than PHP and I don’t know of any examples of doing something like this.

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

The topic ‘update default values when template or parent page is changed’ is closed to new replies.