• Resolved Begin

    (@bentalgad)


    Hi there,

    So i tried to add this code to my plugin:

    add_filter('acfe/settings/php_save/key=group_6125011e58c70', 'my_acfe_php_save_point', 10, 2);
    function my_acfe_php_save_point($path, $field_group){
        
        return plugin_dir_path(__DIR__).'my-settings/inc';
        
    }

    Where ‘group_6125011e58c70’ is of course the id of my fields group, and the folder is my folder of choice to save php to. Also i checked the “PHP” checkbox on that fields group “Advenced Settings” metabox.

    Now i was expecting that when i update this fields group it would save a php file to this folder (am i wrong to expect this behaviour?) but nothing happend when i updated the fields group.

    *When hovering the “PHP” Checkbox is see this error:
    “Awaiting save. Save path not found in theme: /acfe-php”

    Do i have to add this folder to the current theme? (I Need this php file in my plugin’s folder…)

    Thanks,
    Ben

    • This topic was modified 3 years, 2 months ago by Begin.
    • This topic was modified 3 years, 2 months ago by Begin.
    • This topic was modified 3 years, 2 months ago by Begin.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    Your expectations are correct, the PHP file will created and updated at the location designated in the filter everytime you update the Field Group in the ACF admin.

    However, there is a problem in your code. In fact plugin_dir_path(__DIR__) will return the path to the WP Plugins folder: /wp-content/plugins/ and not the folder of your plugin: /wp-content/plugins/my-plugin/.

    I would recommend to use plugin_dir_path(__FILE__) in order to correctly return the full plugin path:

    add_filter('acfe/settings/php_save/key=group_6125011e58c70', 'my_acfe_php_save_point', 10, 2);
    function my_acfe_php_save_point($path, $field_group){
        
        // 2 possible solutions:
        // plugin_dir_path(__DIR__) . 'my-plugin/my-settings/inc'
        // plugin_dir_path(__FILE__) . 'my-settings/inc'
    
        return plugin_dir_path(__FILE__) . 'my-settings/inc';
        
    }
    

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter Begin

    (@bentalgad)

    Wow, that was a basic mistake ??

    Thank you very much!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I’m glad to hear your issue has been fixed!

    If you enjoy this plugin and its support, feel free to submit a review. It always helps and it’s much appreciated ??

    Have a nice day!

    Regards.

    Thread Starter Begin

    (@bentalgad)

    I will!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Thank you very much ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Sync issue’ is closed to new replies.