Search code examples
phpwordpressnfs

Wordpress with NFS wp-content folder causing pathing issues


The NFS mounts are fine and have the correct permissions, but I have the entire wp-content folder in Wordpress mounted on the NFS at /nfs/blog/.

In the taxonomy URL, there is the following code:

wp_enqueue_style(
            'taxonomy-image-plugin-public',
            taxonomy_image_plugin_url( 'style.css' ),
            array(),
            taxonomy_image_plugin_version(),
            'screen'
            );


function taxonomy_image_plugin_url( $file = '' ) {
    static $path = '';
    if ( empty( $path ) ) {
            $path = plugin_dir_url( __FILE__ );
    }
    return $path . $file;
}

You will notice that wp_enqueue_style is calling the function taxonomy_image_plugin_url(). Is there some definition I need to include in the wp-config.php file that will prevent Wordpress from printing out my symlink? The issue is only like this on two plugins. Pretty much, the CSS comes out in the source as this:

Any ideas? I already added define('FS_METHOD', 'direct') tp wp-config.php but would I need to add anything else, like any of the constants here to make Wordpress ignore the symlink? http://codex.wordpress.org/Determining_Plugin_and_Content_Directories


Solution

  • WordPress uses the PHP __FILE__ constant within it's codebase. __FILE__ automagically resolves paths. As such, WordPress will ultimately become aware of /nfs/blog/

    Setting WP_CONTENT_DIR in your wp-config.php should resolve the problem.

    define('WP_CONTENT_DIR', '/nfs/blog');