• Resolved Chris Whitford

    (@fcwhitford)


    I have the wp_content and plugins folders in non-standard locations. FooGallery seems to be looking for its CSS file in WP_CONTENT_URL/plugins/foogallery/… instead of WP_PLUGINS_URL/foogallery/… and fails to find it. I’ve worked around this by moving the plugins folder into the WP_CONTENT_DIR folder, but these should be independent. To be fair, yours is not the only plugin that doesn’t handle this situation correctly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @fcwhitford,

    The plugins in WordPress by default, are not able to detect a custom folder name that replaces the wp-content folder. In order to use a custom folder, you need to define its name in the wp-config.php file. WordPress allows you to define the name of the custom wp-content folder with the help of the WP_CONTENT_FOLDERNAME, WP_CONTENT_DIR, or WP_CONTENT_URL symbol. For more information, please visit on how to rename wp-content folder: https://wpsecurityninja.com/replace-or-rename-wp-content-folder/#How_to_Rename_WP-Content_Folder. If you had replaced the wp-content folder, you can look at this guide: https://wpsecurityninja.com/replace-or-rename-wp-content-folder/#How_to_replace_the_WP-Content_Folder.

    If I may be missing, please elaborate further.

    Kind regards,
    Blaise.

    Plugin Author bradvin

    (@bradvin)

    hi @fcwhitford

    Just to add to what Blaise said, FooGallery builds up the path to the CSS file using the plugin_dir_url function which is the correct function to use, as the stylesheets are within the plugin folder. Under the hood, this function uses WP_PLUGIN_URL and that is defined as

    define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' );

    So it should be working for you is those are defined correctly.

    Thread Starter Chris Whitford

    (@fcwhitford)

    This is what I had in wp-config.php:
    define (‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/files’);
    define (‘WP_CONTENT_URL’, ‘//exhibition.landlps.org.uk/files’);
    define (‘WP_PLUGIN_DIR’, dirname(__FILE__) . ‘/plugins’);
    define (‘WP_PLUGIN_URL’, ‘//exhibition.landlps.org.uk/wp43/plugins’);

    but the missing url was something like
    https://exhibition.landlps.org.uk/files/plugins/foogallery/…..

    I’m not sure the rationale for my file structure was very sound anyway. The main purpose was to not use default file locations because that’s what hackers target.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘non-standard plugin location causes and error’ is closed to new replies.