KbZuhn
KbZuhn

Reputation: 57

Disable url rewriting in woo commerce paged=

I have an installation of woo commerce on my staging server. I've made a custom pagination using url parameter page=

Everything works fine in staging.

When i deploy my woo commerce with duplicator on the final server, urls are rewrited like this...

www.mydomaine.com/mycategory?paged=2 -> www.mydomaine.com/mycategory/page/2/

But I dont want this rewrite.. how can i disable that ? Is that a server configuration or wordpress or woo commerce ? I don't anderstand the difference between my two installations... why one of them don't rewrite and the other does.

Thanks for help !

Upvotes: 1

Views: 268

Answers (1)

Alexander Behling
Alexander Behling

Reputation: 627

Without having a look of your code it's hard determine what is going wrong. Could you please post the snippet which register the custom pagination.

I don't understand why your don't change the pagination_base generally:

This could be done like this:

function my_custom_pagination_base(){
   // Check if the pagination base isn't set already
   if($GLOBALS['wp_rewrite']->pagination_base != 'page'){
     $GLOBALS['wp_rewrite']->pagination_base = 'page';
     // Add this with prio 11 ensures that flush_rewrite_rules will be called when all standard hooks on init are processsed.
     add_action('init','flush_rewrite_rules',11); 
    }
}
add_action('init','my_custom_pagination_base');

This is a modified code of the T5 Page to Seite plugin @see http://toscho.de/?p=2079

Upvotes: 1

Related Questions