Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8890611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:32:30+00:00 2026-06-14T22:32:30+00:00

I made pagination for wordpress, url’s is like Address.com/page/1 Address.com/page/2 , but when I

  • 0

I made pagination for wordpress, url’s is like Address.com/page/1 Address.com/page/2 , but when I click on links I’ being transfer to 404.php , my permalinks settings is: /%postname%/. I think that bug is in permalinks, maybe anyone know what is wrong.

Pagination code:

function pagination( $query, $baseURL = '' ) {  
    if ( ! $baseURL ) $baseURL = get_bloginfo( 'url' );  
    $page = $query->query_vars["paged"];  
    if ( !$page ) $page = 1;  
    $qs = $_SERVER["QUERY_STRING"] ? "?".$_SERVER["QUERY_STRING"] : "";  
    // Only necessary if there's more posts than posts-per-page  
    if ( $query->found_posts > $query->query_vars["posts_per_page"] ) {  

        echo '<ul class="paging">'; 
        // Previous link? 
        if ( $page > 1 ) { 
            echo '<li class="previous"><a href="'.$baseURL.'/page/'.($page-1).'/'.$qs.'">ˠprevious</a></li>'; 
        } 
        // Loop through pages 
        for ( $i=1; $i <= $query->max_num_pages; $i++ ) { 
            // Current page or linked page? 
            if ( $i == $page ) { 
                echo '<li class="active">'.$i.'</li>'; 
            } else { 
                echo '<li><a href="'.$baseURL.'/page/'.$i.'/'.$qs.'">'.$i.'</a></li>'; 
            } 
        } 
        // Next link? 
        if ( $page < $query->max_num_pages ) { 
            echo '<li><a href="'.$baseURL.'/page/'.($page+1).'/'.$qs.'">next</a></li>';
        } 
        echo '</ul>';  
    }  
}   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:32:31+00:00Added an answer on June 14, 2026 at 10:32 pm

    Here is an example that works using WP functions. You can make it a function or try it at the end of each page to replace the function in your question:

    global $wp_query;
    $big = 999999999; // need an unlikely integer
    echo paginate_links( array( 'base'    => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                                'format'  => '?paged=%#%',
                                'current' => max( 1, get_query_var( 'paged' ) ),
                                'total'   => $wp_query->max_num_pages,
                                'end_size'=> 1,
                                'mid_size'=> 10 ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made pagination but, it not work corrent, in each page showing same posts.
I have made this class to retrive parts of an datatable like a pagination,
I would like to use jQuery to refresh a partial on a page, but
I've made my own jquery pagination where when you press the page button, the
I made pagination with PHP and jQuery for topic+entry project Lets say a topic
I made a dll in c# but i need to export the functions. Is
I have come across the ASP.NET ready made controls like grid, repeater... etc. For
made a menu out of the following code but the original href in the
I'm trying to speed up pagination of data on my site. I'd like to
I would like to paginate my objects with the Kaminari pagination gem. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.