Multisite main site wp_upload_dir
-
**NOTE: I’m not talking about “URL rewriting” in a server header sense. I’m talking about the relative URL path to the image file when you insert a photo into a post.
I have 5 blogs set up via sub-domains on WP 3.0.1.
The 4 “sub” blogs all have nice pretty URLs for embedded images cum sa:
/files/yyyy/mm/…
BUT. My main site is displaying the non-rewritten URL:
/wp-content/blogs.dir/[BLOGID]/files/yyyy/mm/…
Looking at the function wp_upload_dir in wp-includes/functions.php, line 2123, the function is checking if its the main blog, and skipping the URL rewrite part of the function.
if ( defined('UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false ) ) { $dir = ABSPATH . UPLOADS; $url = trailingslashit( $siteurl ) . UPLOADS; } if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) { if ( defined( 'BLOGUPLOADDIR' ) ) $dir = untrailingslashit(BLOGUPLOADDIR); $url = str_replace( UPLOADS, 'files', $url ); }
Why does this function not serve up the rewritten URLs for the main blog? I would like all 5 of my blogs to have the “friendly” rewritten URLs.
Finally, if i remove the “!$main_override” check in the final two if/then statements, the main blog behaves correctly in that when you embed a photo, it displays as
- The topic ‘Multisite main site wp_upload_dir’ is closed to new replies.