Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How i can get blog info using site url in multi-site

for eg : if i give the site url as http://a.somename.com and this should return me the value like

Site Name

Site Tag line

Site Database Table Prefix

Used Code

$blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");
echo get_blog_option( $blog_id, 'blogname' );
echo get_blog_option( $blog_id, 'blogdescription' );

If i use the above code i get the details for the below link

http://192.168.0.89/dev/sareepuram/

I use wordpress multi-site

The below link is the main site

http://192.168.0.89/dev/sareepuram/

And this link is the sub site http://192.168.0.89/dev/sareepuram/ss/

My Code Page Looks Like Below

<?php
define('WP_USE_THEMES', false);
require('wp-load.php');

$blog_id = get_blog_id_from_url("http://192.168.0.89/dev/sareepuram/ss/");
echo get_blog_option( $blog_id, 'blogname' );
echo get_blog_option( $blog_id, 'blogdescription' );

?>
share|improve this question
    
If you are using sub directory install then you should use $blog_id = get_blog_id_from_url("192.168.0.89/dev/sareepuram","/ss/"); –  Vinod Dalvi Apr 12 '13 at 6:49
    
@VinodDalvi Not Working Sir –  S.Varun Apr 12 '13 at 6:51
    
Try echo get_blog_option( $blog_id, 'siteurl' ); –  Vinod Dalvi Apr 12 '13 at 6:55
    
i tried but i get the main site details only –  S.Varun Apr 12 '13 at 7:01

1 Answer 1

Use get_blog_id_from_url() function to retrieve blog id from url and then use get_blog_option() function to get information for that blog.

Example :

$blog_id = get_blog_id_from_url("a.somename.com");
echo get_blog_option( $blog_id, 'siteurl' );
echo get_blog_option( $blog_id, 'blogname' );
echo get_blog_option( $blog_id, 'blogdescription' );
share|improve this answer
    
Not Working For Me –  S.Varun Apr 12 '13 at 6:31
    
What is it displaying? are you getting any error? –  Vinod Dalvi Apr 12 '13 at 6:32
    
i have already tried using get_blog_id_from_url() function but no luck –  S.Varun Apr 12 '13 at 6:32
    
i need the details for this site 192.168.0.89/dev/sareepuram/ss but i get the details for the main site 192.168.0.89/dev/sareepuram i used like this $blog_id = get_blog_id_from_url("192.168.0.89/dev/sareepuram/ss/"); echo get_blog_option( $blog_id, 'blogname' ); echo get_blog_option( $blog_id, 'blogdescription' ); –  S.Varun Apr 12 '13 at 6:33
1  
Can you add your code in question so that it can help me to find out the problem.. –  Vinod Dalvi Apr 12 '13 at 6:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.