Can you help me this time to fix this problem
my code is:
public function numeric_pagination() {
global $wp_query , $wp_rewrite;;
if ( $wp_query->max_num_pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
$url_parts = explode( '?', $pagenum_link );
$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $wp_query->max_num_pages,
'current' => $paged,
'total' => $total,
'mid_size' => 1,
'prev_text' => '«',
'next_text' => '»',
'type' => 'array',
) );
if( is_array( $links ) ) {
$pagination = '<div class="pagination-wrap"><ol class="pagination">';
foreach ( $links as $page_key => $page) {
$pagination .= "<li>$page</li>";
}
$pagination .= '</ol></div>';
return $pagination;
}
return false;
}
and my problem is At the end the category main page link gives a "/" which causes redirection 301
example: mysite.com/category/ -> redirect to mysite.com/category
i need remove / in category main page
The rest of the pages are correct example: mysite.com/category/page/2
mysite.com/category/page/3