Home Forums General Issues Issues with wp-content directory outside core directory


Issues with wp-content directory outside core directory

  • Hi Elliot!
    At the moment I am developing a WordPress website with a wp-content folder outside the wordpress core folder. So the folder-structure looks like this:


    That structure is very nice to manage everything in a git-repo including wordpress as submodule. Unfortunately ACF seems to have problems with that structure. In the beginning it didn’t load any css or js files, so the ACF-backend did not work anymore. I could fix it by replacing the function helpers_get_dir with

    function helpers_get_dir( $file )
        return plugin_dir_url(__FILE__);

    That way it works quite properly – except from some strange js-glitches in the edit field-group screens. And the fact, that I can’t set any featured image any more because of an Uncaught RangeError: Maximum call stack size exceeded in line 352 of acf’s input.js.

    Did you or someone else ever use acf successfully in such a situation?


  • I just managed to figure this one out, I too use the same method with sub modules.

    The function you replace in the acf.php passes __FILE__ so will always return the folder of the advanced-custom-fields plugin folder. If you are using a subsequent plugin (in my case acf-repeater), which loads js/css with the same file name – it will result in the js loading twice.

    You need to pass the $file argument into the plugin_dir_url function like so:

    function helpers_get_dir( $file )
        return plugin_dir_url($file);

    Hope this helps!

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

The topic ‘Issues with wp-content directory outside core directory’ is closed to new replies.