Wordpress pagination not working when page has /amp slug

by bilimokur   Last Updated July 20, 2019 11:08 AM

<div class="pagination">
<?php
global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
    'base'      => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format'    => '?paged=%#%',
    'current'   => max( 1, get_query_var( 'paged' ) ),
    'total'     => $wp_query->max_num_pages,
    'prev_text' => __( '<i class="prev"></i>' ),
    'next_text' => __( '<i class="next"></i>' ),
) );
?>

I am using this simple wordpress core pagination function. It is working good.

I added /amp slug with endpoint.

function endpoint_register() {
    add_rewrite_endpoint( 'amp', EP_ALL );
}

add_action( 'init', 'endpoint_register' );

I can access /amp slug in index.php and showing amp content. But pagination doesn't work correctly.

I am trying pagination in wordpress main index.php query.

Tags : slug


Related Questions



10 Character Alpha Numeric Slugs

Updated March 25, 2019 08:08 AM

Remove Slug from Custom Post Type

Updated June 01, 2015 14:03 PM

Change post slug but keep old one

Updated April 12, 2015 20:03 PM

Can't remove slug in url

Updated June 19, 2015 23:03 PM