WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] 404 on author page using custom permalinks and pagination

[Resolved] 404 on author page using custom permalinks and pagination

Viewing 15 replies - 1 through 15 (of 20 total)
  • Can you post your query code?

    I apologize for the nightmare answer, but how do I do that?

    The reason I ask, is I’m not sure what the endpoint is, since it doesn’t seem to be resolving to author.php, but instead going directly to the 404 page. I’m new to wordpress architecture, so I’m not sure how to get the query or what code would be relevant.

    My biggest problem is I don’t know where this redirect is happening.

    It would be on the author.php template.

    I assume this?

    <?php global $paged;
    	query_posts( array(	'post_type' => 'post', 'author'  => $curauth->ID, 'paged' => $paged )	);
    if ( have_posts() ) :
    	while ( have_posts() ) : the_post(); ?>
    <div class="entry"> <!-- blah blah --></div>
    
    <?php           endwhile; ?>
    <?php           // Pagination
    if(function_exists('wp_pagenavi')) :
      wp_pagenavi();
    else : ?>
    <div class="navigation"> <!-- more html --></div>
    <?php           endif; ?>
    <?php
    		if ( get_query_var('paged') ) {
    			$paged = get_query_var('paged');
    		} elseif ( get_query_var('page') ) {
    			$paged = get_query_var('page');
    		} else {
    			$paged = 1;
    		}
    		query_posts( array(	'post_type' => 'post', 'author' => $curauth->ID, 'paged' => $paged ) );
    		if ( have_posts() ) : $count = 0; while ( have_posts() ) : the_post(); $count++;
    		?>

    Try this code at the top instead of what you have there (everything above <div class=”entry”>). Make sure to backup that code though incase it doesnt work. There is another possible solution, but I want to see if this works first.

    Replaced, same result. I tried: /blog/dr-fiona-nd/page/1/ and also got the 404. I think the endpoint isn’t resolving because I tried echoing an html comment as the first line of code in author.php and I didn’t see that show up on the 404 page, but I did see it via the direct path (so I know the change was propagating).

    k, I tried replacing the entire page with <?php echo “test”; ?>

    and the paginated view still returned the 404… That leads me to think the problem is elsewhere?

    Does this sound correct?

    Do you have a custom post type set for authors?

    I think what’s happening is the permalink is attempting to take the site to a post because of the permalink structure. I think I might need to add a rewrite rule to make this work?

    I’m pretty sure I could construct the regex to detect the redirect, something maybe like:

    /blog/[\w\d-]*/page/[\d]*/

    but what I’m not sure of is how I can pass that information to the author page? Do I redirect to something like path/author.php?page=n

    Whatever you just did has it working for me now.

    I don’t think so.

    interesting, it’s not working for me? Is it still working?

    Well when I click on the author of the post it goes to use the author.php template file but it looks like you are using a page template right?

    http://www.whitelotusclinic.ca/blog/dr-fiona-nd/

    What page template is this using, if it is using a query in here post that.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘[Resolved] 404 on author page using custom permalinks and pagination’ is closed to new replies.