• I’ve made a custom page-template to generate random post and re-direct users into that post.

    <?php
    /**
     * Template Name: Random Post
     */
    ?>
    
    <?php
        query_posts('orderby=rand');
        while (have_posts()) {
            the_post();
            wp_redirect(get_permalink());
        }
    ?>
    
    <?php get_header(); ?>
    <?php get_footer(); ?>

    It works well in localhost, but when I actually applied it on my site. I got this warning while opening the page:

    Warning: Cannot modify header information – headers already sent by (output started at /home/admin1/public_html/wp-content/themes/bumi2013/template-random-post.php:7) in /home/admin1/public_html/wp-includes/pluggable.php on line 866

    Any idea how to solve this problem?

Viewing 1 replies (of 1 total)
  • Thread Starter earthshaver

    (@earthshaver)

    Some people told me that turning-off other plug-ins might solve the problem. I’ve tried it, but it doesn’t solve the problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with random post’ is closed to new replies.