Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Link to show a random blog (Mu/MultiSite) WordPress


On my site, I have a menu option for showing a random blog, but I can't figure out what I need to do to link to a random blog.

I'm using the new menus system of WordPress 3.

Answers (3)


Pippin Williamson answers:

Here you go:

Pippin Williamson comments:

Whoops, you said random blog, sorry.

You wish probably require a membership, but here's another one:

It's number 12 in the list.

Joe Jenkins comments:

I saw about the /?random when I was tryign to figure this out, but that is for a specic blog.

I'm looking for a way to show info on a random blog:,,, etc

Pippin Williamson comments:

Take a look at the second link I posted.

Joe Jenkins comments:

Ah, I messied that one while I was writing.

That link doesn't go to the plugin anymore, it just links directly to, and the plugin isn't available on there :( It looks like the exact thing I was after.


Eddie Moya answers:

Stick this in your functions.php

function random_blog_link(){
$blog_list = get_blog_list( 0, 'all' );
$rand = rand(1, count($blog_list));
echo '<a class="random_blog_link" href="' . $blog_list[$rand]['path']. '">' . get_blog_option( $blog_list[$rand]['blog_id'], 'blogname' ) . '</a>';

Then just call the function wherever you need your random link. It will generate the entire link including <a href=""> and </a>.

<strong>Warning, this will work on 3.0 - however it is based on something I did for 2.9.2. The functions used here are deprecated and may not work in future version.

Joe Jenkins comments:

How would I call that funtion using the menu system in wp3 admin?

Joe Jenkins comments:

I add this to a custome link:

<? phpechoget_option('blogname'); ?>

After saving the menu, I end up with this:


Joe Jenkins comments:

Sorry, I just pasted in something totally different.

I'll try that again.

I add this to a custom link:

<?php echo get_option('random_blog_link'); ?>

After saving the menu, I end up with this:


Eddie Moya comments:

The link is not saved as an option. You should be calling it as such:

<!--whatever html you have before the link -->
<?php random_blog_link(); ?>
<!--whatever html you have after the link-->

A more realworld example might look like this ...

Behold! A Random Blog Link!
<?php random_blog_link(); ?>

Again... you dont need to create the <a href=""> </a> parts yourself.. the function i made for you does all that. And its not being added to the options table. All you should need to do it call the function itself.

Last Note: You dont need to use <strong>echo</strong> with this function. It does that on its own. You just need to call the function in the place where you want that link to appear.

Eddie Moya comments:

A little explanation might be due. The reason I have the function create the entire link instead of just the url is because you need the blog name to show up as the title (i presume) of the link. So for simplicities sake I just did it all at once.


powerflash answers:

You can use "Random Blog Redirect" plugin , this is specific for WP MU but I think that with WP 3 multisite it work
Plugin URI:

when activated every you browse this url it redirect to random blog url