Home › Forums › ACF PRO › acf-json not updating › Reply To: acf-json not updating
Hi, i’ve found something, but i don’t know if is your case.
I’m using acf-pro on a mulsite enviroment and i’ve found and issue when using child themes.
Scenario: i want to create and modify my custom fields on my parent theme, localhost, and show on wp-admin for users but don’t let they change the fields on server, so i decided to use acf-json.
When i’m using the same theme, it works fine, but when i’m using child themes, the fields do not update.
Testing my site i’ve found that when i’m using child themes, the fields are saved to “current” theme, even if the current theme is a child theme.
Change the default save and load options, from “get_stylesheet_directory()/acf-json” to “get_TEMPLATE_directory()/acf-json”.
The function get_template_directory() returns the main directory for the theme if is parent and the parent_directory if is a child theme, so now it works fine and i can control my fields only in the parent theme.
Hope it can help you! 😉
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We’re hard at work on ACF 6.1, and Beta 1 is now available 🚀— Advanced Custom Fields (@wp_acf) March 16, 2023
This release includes custom post type and taxonomy registration, an improved experience when selecting field types, PHP 8.1 and 8.2 compatibility, and more!
Let’s take a look 🧵https://t.co/Y0WcAT11l4
© 2023 Advanced Custom Fields.