Interesting. I will have to test this out to come back with a solution. Would you please provide some more reference or step to replicate the issue? Which theme are you using?
I was able to reproduce using the twentynineteen theme.
– Install ACF PRO
– Create the acf-json dir in the theme root
– Install acfBlocks
– Create an acf group
– Look in plugins/acf-blocks/acf-json. You will see that the newly created field group is located in your plugins acf-json dir and not in the themes acf-json dir
Thank you for the explanation. I just tested it and was able to replicate the issue. Looks like you have not defined the save point and loading point for this local JSON folder in your theme. Once you define both, it will not merge/conflict with the ACFBlocks plugin.
Here is the official documentation on this by ACF plugin.
Please try and update me if that helps.
@munirkamal yep that worked. Thanks!
Great. Glad this works for you now. 😇
If you are happy with the plugin and efforts to please take a minute to write a review, that would be very helpful.
@munirkamal It might be a good idea to add this issue to your plugin docs or better yet remove that piece of code from the plugins production code. I feel like 9 times out of ten theme developers are not defining their ACF save points. It seems a little heavy handed for a plugin to use that default save point. Just a thought.
Not sure what you mean exactly but, we have defined our custom save points for our JSON, similarly if a developer (theme or plugin) is using this feature they should also define their custom save points. This is how it works? We are not using default save points unless I am mistaken your point?
If a developer is following the ACF documentation he is good to go as it is documented there very clearly.
@munirkamal There is no need to define a save point unless you want to save to a custom location. From the acf local json documentation:
To start using the local JSON feature, simply create a new folder in your theme and name it acf-json. This folder must have permissions for the server to read and write (in most cases 755 will work well).
Once this folder exists, each time you save a field group a JSON file will be created (or updated) with the field group and field settings. The JSON file will be named using the field group’s unique key.
Now that the JSON file exists, ACF will load the relevant field group and field settings from this file which reduces the number of database calls during your page load!
As you can see from the documentation there is no need to define a save point. All you need to do is create the dir “acf-json” in the theme root and ACF will automatically save to that directory there is no further code needed to make this work, but yes it does go on to explain how to create a custom save point if you do not want to use the default acf-json directory as the default.
Try it for yourself. Install a theme with ACF Pro and create the directory “acf-json” and create a custom field group. You will see that ACF does not need a save point defined and the group json will be added to the dir “acf-json”. Make sure your plugin in not installed first though.
Having your code defining the save point in your plugin now forces the theme developer to add their own save point code. I would think you would want to make this clear in your documentation that if you would like to use your plugin and use acf local json in your theme that you need define your save point.
- This reply was modified 4 years, 2 months ago by nickberens360.
Ahh. I see. Thank you for explaining it in more detail. I will test it out by not defining custom save points in the plugin as you suggested, if that will work fine with the theme’s custom JASON directory I will remove that custom save points from the plugin. And if it still conflicts, I will add it to the documentation as you suggested.
Thanks again for all the time you took to explain and report this to me.
- The topic ‘acf-json in plugin disables acf-json in theme’ is closed to new replies.