Title: acfe/php_load does not load fields in a plugin (autosync)
Last modified: March 17, 2022

---

# acfe/php_load does not load fields in a plugin (autosync)

 *  Resolved [wedevelopthings](https://wordpress.org/support/users/milleniumwa/)
 * (@milleniumwa)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/acfe-php_load-does-not-load-fields-in-a-plugin-autosync/)
 * When I try to use autosync php for my field groups at a plugin path, ACF/ACFE
   does still load from DB.
 * This is the code used in the plugin:
 *     ```
       add_action('acf/init', function(){
           acf_update_setting('acfe/php_save', plugin_dir_path( __FILE__ ) . 'includes/acfe-php/');
   
           $load_paths_php = acf_get_setting('acfe/php_load');
           $load_paths_php[] = plugin_dir_path( __FILE__ ) . 'includes/acfe-php/';
           acf_update_setting('acfe/php_load', $load_paths_php);
       });
       ```
   
 * On saving a ACF field group, the file gets created correctly at this path, like“
   group_62333df612391.php”. The contents of the saved file also is correct (chmod
   644, readable). But ACF still show it’s loaded from DB and the warning occurs:
 * > Awaiting save. <br />Save path located in plugin: /pluginname/includes/acfe-
   > php
 * When I disable the action to the default path (theme/acfe-php) it works. It gets
   saved to the theme folder and also loads from php and not from DB.
 * I also tried a fresh installation with a fresh database and could reproduce the
   problem.
 * Also, the path shows correctly at ACF » Settings » AutoSync » PHP Load.
 * And if I replace the path, instead of adding one, the problem still exists.
 *     ```
       WP: 5.9.2
       ACF: 5.11.4
       ACF Pro 5.11.4
       ACFE 0.8.8.7
       ```
   
    -  This topic was modified 4 years, 5 months ago by [wedevelopthings](https://wordpress.org/support/users/milleniumwa/).
    -  This topic was modified 4 years, 5 months ago by [wedevelopthings](https://wordpress.org/support/users/milleniumwa/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/acfe-php_load-does-not-load-fields-in-a-plugin-autosync/#post-15499061)
 * Hello,
 * Thanks for the feedback!
 * The PHP/Json AutoSync settings are quite special as they are executed before 
   the `acf/init` hook. This logic is also applied on the native [ACF Json documentation](https://www.advancedcustomfields.com/resources/local-json/).
   You should directly filter the setting using `add_filter()` instead of using `
   acf_update_setting()`.
 * You’ll find working example for the Json/PHP AutoSync with ACF Extended in the
   [documentation here](https://www.acf-extended.com/features/field-groups/autosync).
   Here is a working example in your case:
 *     ```
       add_filter('acfe/settings/php_save', 'my_acfe_php_save_point');
       function my_acfe_php_save_point($path){
   
           return plugin_dir_path(__FILE__) . 'includes/acfe-php';
   
       }
   
       add_filter('acfe/settings/php_load', 'my_acfe_php_load_point');
       function my_acfe_php_load_point($paths){
   
           $paths[] = plugin_dir_path(__FILE__) . 'includes/acfe-php';
   
           return $paths;
   
       }
       ```
   
 * Hope it helps!
 * Have a nice day!
 * Regards.
 *  Thread Starter [wedevelopthings](https://wordpress.org/support/users/milleniumwa/)
 * (@milleniumwa)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/acfe-php_load-does-not-load-fields-in-a-plugin-autosync/#post-15502414)
 * Hello,
 * thank you very much, this worked fine! I would not have thought that `acfe/settings`
   would be executed before `acf/init` 🙂
 * To make it perfect, I still have `acf_update_setting` still in the code so that
   the changed paths continue to be displayed correctly in the settings under “AutoSync”.
   Without `acf_update_setting` the path changes are not visible.
 * Best greetings!
 *  Plugin Author [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * (@hwk-fr)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/acfe-php_load-does-not-load-fields-in-a-plugin-autosync/#post-15508174)
 * Hello,
 * I’m glad to hear it now works as expected!
 * You’re right, the `acfe/php_save` value isn’t correctly updated in the “Registered”
   column of the Settings UI. This is because the method used to collect those settings
   doesn’t pass values thru the `acf/settings` filters. I just added a fix for that
   issue for the next patch.
 * You don’t need to keep that `acf_update_setting()` in your code, as the filter
   method will be correctly use in all cases behind the scene. The setting isn’t
   correctly displayed in the Settings UI as of now, but it’s just a visual issue.
   It will be fixed in the next patch.
 * Thanks for the report!
 * Have a nice day!
 * Regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘acfe/php_load does not load fields in a plugin (autosync)’ is closed 
to new replies.

 * ![](https://ps.w.org/acf-extended/assets/icon-256x256.png?rev=2071550)
 * [Advanced Custom Fields: Extended](https://wordpress.org/plugins/acf-extended/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-extended/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-extended/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-extended/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-extended/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-extended/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Konrad Chmielewski](https://wordpress.org/support/users/hwk-fr/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/acfe-php_load-does-not-load-fields-in-a-plugin-autosync/#post-15508174)
 * Status: resolved