[Resolved] get_site_url function not getting the correct blog_id
I’ve been digging for a long time in this problem, and I don’t know what else to do. I have a multisite install and the dashboard on wp-admin shows an strange bheaviour on internal blogs. On root blog (/) everything works fine. However, when acess any other dashboard (such as /teste/wp-admin) the following happens:
1 – The edit post link on posts list is broken. It doesn’t show the right post URL
2 – The categories are also broken, because they show the category from the main blog
3 – Media upload is also not working. Instead of pointing to the site’s media upload link (/teste/wp-admin/media-upload.php) the link points to main site (/wp-admin/media-upload.php)
Debugging the code I found the main reason: the function get_admin_url calls get_site_url passing $blog_id as null, and get_site_url doesn’t get the actual blog ID. As it doesn’t get the actual blog_id, all the links are pointing to main site instead of pointing to the blog.
It also affects categories, tags and everything else on the metaboxes, because all the options are rendered form the main site.
The following check fails on get_site_url:
if ( empty( $blog_id ) || !is_multisite() )
$url = get_option( 'siteurl' );
$url = get_blog_option( $blog_id, 'siteurl' );
$blog_id should be a global var and hold the actual blog_id, but it’s empty at this point.
I’m out of options here. Can someone give a light so I know at least where to search for answers?
- The topic ‘[Resolved] get_site_url function not getting the correct blog_id’ is closed to new replies.