WP_CONTENT_URL
-
I’ve followed the instructions here for moving my
wp-contentfolder and putting the rest of WordPress inside awpfolder, so file structure:
wp
wp-content
index.php
wp-config.phpHowever, I’ve got a problem with this line:
define( 'WP_CONTENT_URL', 'http://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/wpwith 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_urlorcontent_url, so my current solution is to filter both of those and not define a newWP_CONTENT_URLat 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.