acf-extended / ACF-Extended

🚀 All-in-one enhancement suite that improves WordPress & Advanced Custom Fields
https://www.acf-extended.com
238 stars 27 forks source link

ACFE PHP Save/Load Paths Not Working on Pantheon Hosted Website #97

Closed digisavvy closed 2 years ago

digisavvy commented 2 years ago

Describe the bug I'm having an issue where ACFE is not saving/syncing to the acfe-php folder on my site I'm working with. It's hosted on Pantheon.

To Reproduce I created the acfe-php folder inside the active theme folder first. But the syncing wasn't happening. I get the error save path not found in theme acfe-php.

I tried updating the folder locations using a pair of filters I found in the WP.org plugin support forums, still, I had the same issue. I've tried saving my field groups, adding fields/removing fields and I get the same error. I tried even creating a symlink that points from the theme folder /acfe-php location to a location in uploads folder (which is writeable by Pantheon) and still no joy.

Expected behavior I expect ACFE to be able to write to the appropriate folders

Screenshots Screenshot 1

WordPress & ACF WordPress version: 5.8.2 ACF Pro version: 5.11.4 ACF add-ons: 0.8.8.7

Add any other context about the problem here.

digisavvy commented 2 years ago

Also, here's the code I placed inside functions.php to change these paths

 /**
  * Change where the ACFE PHP Save/Load folder is located. We do this
  * for Pantheon Compatibility.
  */
add_action('acf/init', 'iwp_acfe_php_paths');
function iwp_acfe_php_paths(){

    /*
     * Change PHP Save Path
     */
    acf_update_setting('acfe/php_save', get_site_url() . '/wp-content/uploads/acfe-php/');

    /*
     * Change PHP Load Path
     */
    acf_update_setting('acfe/php_load', array(get_site_url() . '/wp-content/uploads/acfe-php/'));

}
acf-extended commented 2 years ago

Hello,

Thanks for the feedback!

The get_site_url() function will return an URL like https://www.example.com. PHP need local server path in order to write & include PHP files, like /var/www/example.com/file.php.

In order to get local path you can use the following methods:

Hope it helps!

Have a nice day!

Regards.