[wp-trac] [WordPress Trac] #7709: 'content_url' not pluggable

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 8 12:48:00 GMT 2008


#7709: 'content_url' not pluggable
----------------------+-----------------------------------------------------
 Reporter:  krudolph  |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  low       |   Milestone:  2.8      
Component:  General   |     Version:           
 Severity:  minor     |    Keywords:           
----------------------+-----------------------------------------------------
 Hi,

 A call to `content_url` invariably returns the whole path, including the
 "http[s]://" prefix and the server name. This may not be desired. In fact,
 I've written a filter function for `option_siteurl` and `option_home` to
 strip ''all'' local URIs off their server name, i.e.
 "http://example.com/blog/x" becomes "/blog/x".

 However, since `content_url` isn't pluggable, my filter function doesn't
 catch all URIs (especially not theme-related URIs such as the stylesheet
 link). Actually, `content_url` uses `WP_CONTENT_URL`, which, in turn,
 calls `get_option('siteurl')`, which, in turn, is pluggable.
 Unfortunately, this call is made ''before'' filter functions get
 registered because `WP_CONTENT_URL` is a global constant.

 I propose two possible solutions:

 • Make `WP_CONTENT_URL` a function. Since the constant is for internal use
 only, the scope of this change should be local. This solution would be
 preferred because it means that one hook would suffice to manipulate all
 local URIs created by !WordPress.

 • Make `content_url` pluggable.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7709>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list