Change “/” (slash) before page number in pagination path to “-” (hyphen)
Question
Is it possible to change the “/” (slash) before the page number in the pagination link to “-” (hyphen)?
Example: “mysite.com/category-name/page/2/” to “mysite.com/category-name/page-2/”
I did the following:
$base = str_replace( 'page/'.$big, 'page-%#%', get_pagenum_link( $big, false ) );
$pages = paginate_links(
apply_filters( 'ru_pagination_args', array(
'base' => esc_url_raw($base),
'format' => '%#%',
'total' => $max,
'current' => $cur,
'show_all' => false,
'end_size' => 1,
'mid_size' => 2,
'prev_next' => true,
'prev_text' => $prev,
'next_text' => $next,
'type' => 'array',
'add_args' => false,
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => '',
) )
);
The pagination link is as I expected, but it redirects to the 404 page.
Any help is appreciated.
0
2 months
2023-03-23T10:47:34-05:00
2023-03-23T10:47:34-05:00 0 Answers
0 views
0
Leave an answer