• Resolved nickberens360

    (@nickberens360)


    Love your plugin first of all, but the plugin takes my acf field groups json and adds them into your plugins acf-json folder and skips adding it to my themes acf-json folder. Any way to fix this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Munir Kamal

    (@munirkamal)

    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?

    Thread Starter nickberens360

    (@nickberens360)

    I was able to reproduce using the twentynineteen theme.

    Steps

    – 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

    Plugin Contributor Munir Kamal

    (@munirkamal)

    Hi @nickberens360,

    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.
    https://www.advancedcustomfields.com/resources/local-json/

    Please try and update me if that helps.

    Thread Starter nickberens360

    (@nickberens360)

    @munirkamal yep that worked. Thanks!

    Plugin Contributor Munir Kamal

    (@munirkamal)

    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.

    Thread Starter nickberens360

    (@nickberens360)

    @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.

    Plugin Contributor Munir Kamal

    (@munirkamal)

    @nickberens360

    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.

    Thread Starter nickberens360

    (@nickberens360)

    @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:

    Getting started
    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.

    Plugin Contributor Munir Kamal

    (@munirkamal)

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘acf-json in plugin disables acf-json in theme’ is closed to new replies.