Forums

Author template page 404 error on multiple pages (3 posts)

  1. frankthetank
    Member
    Posted 1 year ago #

    Hi,

    I'm using an author template to show his posts of that user. It's working great for the first page, but when I go to another page, it gives me an 404 error page.

    http://celebrites.mesopinions.ca/author/frankthetank = WORKS
    http://celebrites.mesopinions.ca/author/frankthetank/page/2 = 404

    I did recreate a test on my local machine with the same settings and it works ! I also recreated the .htaccess file to be sure and still the 404. I'm using something similar on my other site and I do not get an 404 error ( http://mesopinions.ca/author/frankthetank/page/2 ). I also tried with the twenty ten theme but I get the same error (it give's me the same url).

    I already went to the permalink page in admin to regenerate everything, still the 404.

    Any idea what is causing this ?
    Thanks a lot

  2. mesopinions
    Member
    Posted 1 year ago #

    Anyone got the same problem ??
    Can't figure out what is causing this on that website, and not on the test one with the same configs...

  3. mesopinions
    Member
    Posted 1 year ago #

    The problem was that the query in the author.php was querying only the post_type='post'. Even if I added the arguments in the query_posts function, it would still query only the post.

    To fix it, only add this code

    add_filter('parse_query', 'parse_query_handler');
    function parse_query_handler($q){
    	if (isset($q->query_vars['author_name']) && $q->query_vars['author_name'] != ''){
    		$q->query_vars['post_type'] = array("photos", "videos", "nouvelles");
    	}
    	return $q;
    }

    Replace the array("photos", "videos", "nouvelles"); with your custom post types.

Topic Closed

This topic has been closed to new replies.

About this Topic