Support

Account

Home Forums Bug Reports ACF Plugin broken when wordpress has its own directory

Solved

ACF Plugin broken when wordpress has its own directory

  • Hi,
    I’m running acf 4.3.9 on wordpress 4.0.

    I’ve noticed a bug when running wordpress in its own directory, like so: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    The bug is with the $settings[‘dir’] variable which doesn’t get assigned the proper value. Instead of setting this (good one):
    wordpress/wp-content/plugins/advanced-custom-fields/
    it sets this (wrong one)
    wordpress/wp-contentplugins/advanced-custom-fields/

    What it does is that it prevents acf from loading any CSS / JS because it can’t find them, which makes the plugin unusable (can’t add / edit fields or anything).

    The issue comes from line 130 of acf.php, and I could fix it by changing this:

            if( $count < 1 )
            {
    	        // if file is in wp-content folder
    	        $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR); 
    	        $dir = str_replace($wp_content_dir, content_url(), $dir, $count);
            }

    with this:

    if( $count < 1 )
            {
    	        // if file is in wp-content folder
    	        $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR); 
    	        $content_url_with_slash = content_url() . '/';
    	        $dir = str_replace($wp_content_dir, $content_url_with_slash, $dir, $count);
            }

    Can we fix this bug in the official plugin? I don’t want custom code in them!

    I’m available for doing more testing if needed.

    PS: just realized that “forums are no longer used for support tickets”, feel free to delete this if it’s not accepted…

  • my bad, this was an error in fixing the content_url path in my config.php file, this was causing issues with other plugins too. Nothing broken in acf.

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

The topic ‘ACF Plugin broken when wordpress has its own directory’ is closed to new replies.