Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#26090 closed defect (bug) (invalid)

plugins_url() breaks on non-default WP_CONTENT_DIR

Reported by: kanuck54 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: Cc:


I noticed that both the VaultPress and Regenerate Thumbnails plugins were suddenly failing to load their stylesheets upon updating from WordPress 3.5.x to WordPress 3.7.2.

A quick look at the stylesheet URLs revealed a problem:

<link rel='stylesheet' id='vaultpress-nav-css'  href='http://server.com/wp-content/plugins/srv/www/application/dist/www/wp-content/plugins/vaultpress/nav-styles.css?ver=20131117' type='text/css' media='all' />

The full absolute file path to the stylesheet is being inserted into the URL (it should just be
http://server.com/wp-content/plugins/vaultpress/nav-styles.css?ver=20131117 without the superfluous /srv/www/application/dist/www/wp-content/plugins).

Both plugins enqueue stylesheets the same way:

wp_enqueue_style( 'vaultpress-nav', plugins_url( '/nav-styles.css', __FILE__ ), false, date( 'Ymd' ) );

It seems that somewhere between 3.5.x and 3.7.2, that plugins_url() function call stopped working as intended.

Change History (4)

#1 @Ipstenu
4 years ago

Do you mean WP 3.7.1? There isn't a .2 yet.

How did you define your wp-content directory and to what?

#2 @kanuck54
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed
define('WP_CONTENT_DIR', '/srv/www/application/local/wp-content');
define('WP_CONTENT_URL', 'http://server.com/wp-content');

WordPress is installed at /srv/www/application/dist/www/wordpress.

I did figure it out, though, and it wasn't a regression after all, as far as I can tell; it turns out the internal function plugin_basename() gets confused when WP_PLUGIN_DIR is a symbolic link – which is fair, I suppose. Setting WP_PLUGIN_DIR manually in wp-config.php to the destination of the symbolic link fixes this behaviour.

Last edited 4 years ago by kanuck54 (previous) (diff)

#3 @rmccue
4 years ago

Related: #16953

#4 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
  • Version trunk deleted

Previously: #13550, #16199.

Note: See TracTickets for help on using tickets.