WP_CONTENT_URL
-
I’ve followed the instructions here for moving my
wp-content
folder and putting the rest of WordPress inside awp
folder, so file structure:
wp
wp-content
index.php
wp-config.php
However, I’ve got a problem with this line:
define( 'WP_CONTENT_URL', 'https://example/blog/wp-content' );
If I move my WordPress from that URL, I have to manually update whatever file I put this in. Now, I could use something like:
define('WP_CONTENT_URL', get_option('siteurl').'/wp-content');
But that won’t work in
wp-config.php
, which seems like the logical place to put these defines. And even so, that particular variable goes to/wp
with my structure, which isn’t correct, so I would end up usingdefine('WP_CONTENT_URL', get_option('home').'/wp-content');
ordefine('WP_CONTENT_URL', get_option('siteurl').'/../wp-content');
, ifget_option()
worked at that time, that is.This has only become an issue when using
plugins_url
orcontent_url
, so my current solution is to filter both of those and not define a newWP_CONTENT_URL
at all. So it defaults todefine( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
and in the filter I can do a quick string replace to add/../
. This seems cumbersome and I can’t possibly have a filter for every WP function that will use that constant. Any alternatives?
- The topic ‘WP_CONTENT_URL’ is closed to new replies.