Support » Plugins and Hacks » Link to random post, pointing to my local installation?!

  • On my site I’m using the following code to make a link that takes you to a random post:

    $randomPost = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1");
    echo '<a href="'.$randomPost.'">Next &rarr;</a>'; ?>

    It works on my local installation on my computer, but when I upload the theme to, it retrieves a random post with an URL on my computer installation instead of the WordPress site online.

    How do I fix this?

  • The topic ‘Link to random post, pointing to my local installation?!’ is closed to new replies.