简体   繁体   中英

wordpress paginate_links url

my code looks like this:

paginate_links( 
  array(
   'next_text' => __('>'), 
   'prev_text' => __('<'), 
   'base' => @add_query_arg('page', '%#%'), 
   'format' => '?page=%#%&a='.$a, 
   'total' => ceil($count/$per_page), 
   'current' => $page)
)

Everything works perfectly but if I click on for example second page my url goes to www.domain.com/something/2/?a=5 instead of www.domain.com/something/?page=2&a=5

Is it possible to change it into www.domain.com/something/?page=2&a=5 ?

It is because you use permalinks :

format (string) (optional) Used for Pagination structure. The default value is '?page=%#%', If using pretty permalinks this would be '/page/%#%', where the '%#%' is replaced by the page number. Default: '?page=%#%'

Just rename the var page into something else

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM