Home Forums Backend Issues (wp-admin) Problem with Local Dev, Symbolic Links, & Asset Paths


Problem with Local Dev, Symbolic Links, & Asset Paths

  • In general, I use MAMP for local development, with a WordPress installation that is installed locally, but with a wrinkle: “wp-content” in my local installation is actually a symbolic link to a folder that resides in Dropbox.

    This is causing issues with the paths for ACF’s CSS and JS assets.

    In my console, I see a bunch of failed http requests that look like so, for any ACF asset:


    Everything after wp/ is the absolute/real/non-symbolic path to the file, whereas a successful request would have been:


    How can I override this behavior so that I can develop locally using symbolically linked files? I only have this problem with ACF and its add-ons.

  • I just bought the pro version of the plugin, and I am also having the same issue on a local installation with paths not pulling in JS and CSS when the plugin is included in a theme directory, not as a plugin.

    I see that there are a few path settings at the top of acf.php, but I’m not sure if I should be changing these or not:

    Any ideas?

    			// urls
    			'basename'			=> plugin_basename( __FILE__ ),
    			'path'				=> plugin_dir_path( __FILE__ ),
    			'dir'				=> plugin_dir_url( __FILE__ ),
  • Hi @gato-gordo,

    Thanks for the post.

    You can customize the paths and directory that has ACF by making use of the acf/settings filter.

    // 1. customize ACF path
    add_filter('acf/settings/path', 'my_acf_settings_path');
    function my_acf_settings_path( $path ) {
        // update path
        $path = get_stylesheet_directory() . '/acf/';
        // return
        return $path;
    // 2. customize ACF dir
    add_filter('acf/settings/dir', 'my_acf_settings_dir');
    function my_acf_settings_dir( $dir ) {
        // update path
        $dir = get_stylesheet_directory_uri() . '/acf/';
        // return
        return $dir;
    // 4. Include ACF
    include_once( get_stylesheet_directory() . '/acf/acf.php' );
  • I am using the free version of this plugin. It is installed globally, *not* via another plugin or theme. As such, it exists at /wp-content/plugins/advanced-custom-fields/.

    However, in my deloyment, /wp-content/plugins is actually a symlink to “../../wordpress/plugins”, which resolves to /srv/php/$job_name/wordpress/plugins/. Uploads and themes are done the same way. It was done like this, because the entirety of wordpress is built with a docker image, and is mounted RO, to prevent file overwrite intrusion attempts.

    I am also seeing js/css urls like http://$host_name/srv/php/$job_name/wordpress/plugins/advanced-custom-fields/….

    This is due to using __FILE__ in the __construct() function, and then attempting to send that in the enque_script/enqueue_style callouts. Adding a filter in my job_plugin, or job_theme, won’t help, as the advanced-custom-fields plugin is initialized *first*, so the acf/helpers/get_dir filter has already run.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Problem with Local Dev, Symbolic Links, & Asset Paths’ is closed to new replies.