Issues with Paginate in Search
-
On my site, I’m noticing that the deeper I try and look into certain archived paginate elements, I’m getting a lot of broken links. Having trouble pinpointing why.
Examples:
Category — this works fine. Page 1, Page 13
Tags — this doesn’t work. Page 1, Page 8 (this will work up to Page 5, then break)
Authors — this also doesn’t work. Page 1, Page 162I was using this article to troubleshoot, but I’m still having issues narrowing down the actual issue causing Tags and Authors to break, but not Category. Within the Settings of Permalink, I’m using the custom structure of “/%category%/%postname%/” which I originally thought might be tied to this, but I’m not quite sure.
Here’s the line of code I have on search results:
<div class="latest-wrapper"> <?php if ( have_posts() ) : ?> <h2 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'mvc' ), '<span>' . get_search_query() . '</span>' ); ?></h2> <h5><?php echo paginate_links( $args ); ?></h5> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php /** * Run the loop for the search to output the results. * If you want to overload this in a child theme then include a file * called content-search.php and that will be used instead. */ get_template_part( 'content', 'search' ); ?> <?php endwhile; ?> <br clear="all" /> <h5><?php echo paginate_links( $args ); ?></h5> <?php else : echo '<h2>No content found</h2><p>Please try another search or view our <a href="/archive/">Archives</a>.</p>'; endif; ?> <hr /> <h2> Search</h2> <?php get_search_form(); ?> <br clear="all" /> </div>
Any help appreciate — thank you!
- The topic ‘Issues with Paginate in Search’ is closed to new replies.