On my site muchzen.com I’m using the following code to make a link that takes you to a random post:
<?php $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 →</a>'; ?>
It works on my local installation on my computer, but when I upload the theme to muchzen.com, 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.