WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simple question. When pagination is activated, the URL changes to "site.com/page/2". For my site, this should be "site.com/paggetto/2".

How can I change that rewrite rule? I also want to change "author" and other variables.

share|improve this question
up vote 10 down vote accepted

For some sites in German I use the following plugin to translate page to seite (the German word for page):

<?php # -*- coding: utf-8 -*-
 * Plugin Name: T5 Page to Seite
 * Description: Ersetzt <code>/page/</code> durch <code>/seite/</code>.
 * Author:      Thomas Scholz <info@toscho.de>
 * Author URI:  http://toscho.de
 * License:     MIT
 * License URI: http://www.opensource.org/licenses/mit-license.php

if ( ! function_exists( 't5_page_to_seite' ) )
    register_activation_hook(   __FILE__ , 't5_flush_rewrite_on_init' );
    register_deactivation_hook( __FILE__ , 't5_flush_rewrite_on_init' );
    add_action( 'init', 't5_page_to_seite' );

    function t5_page_to_seite()
        $GLOBALS['wp_rewrite']->pagination_base = 'seite';

    function t5_flush_rewrite_on_init()
        add_action( 'init', 'flush_rewrite_rules', 11 );

Note that you flush the rewrite rules on de/activation only. You will need a separate rewrite rule in your .htaccess to redirect old URLs to the new ones:

RedirectMatch Permanent ^/(.*)/page/(.*) /$1/seite/$2
share|improve this answer
What's the difference between $GLOBALS['wp_rewrite']->pagination_base = 'seite' and $wp_rewrite->search_base = 'buscar'; ? – DarkGhostHunter Jul 1 '12 at 21:05
There are subtle and unintuitive differences between global $var; and $GLOBALS['var']. Doesn’t matter in this case, just keep in mind that the latter form is more reliable and easier to read/understand. – toscho Jul 1 '12 at 21:09
could we do url adress like site.com/2 i just tried that but it says no posts found. – Fatih Toprak Feb 15 '13 at 6:57
@FatihToprak I think this would get in conflict with everything: post type page, date archives, custom post types. Not worth the trouble. – toscho Feb 15 '13 at 8:21
@toscho thanks for your replay but i really dont need post type archive and page just want to use it regular category archives. – Fatih Toprak Feb 17 '13 at 1:21

Figured out:

function re_rewrite_rules() {
    global $wp_rewrite;
    // $wp_rewrite->author_base = $author_slug;
//  print_r($wp_rewrite);
    $wp_rewrite->author_base        = 'autor';
    $wp_rewrite->search_base        = 'buscar';
    $wp_rewrite->comments_base      = 'comentarios';
    $wp_rewrite->pagination_base    = 'pagina';
add_action('init', 're_rewrite_rules');

At least, that will do the job.

share|improve this answer
Just one small notice, because of how extremely costly $wp_rewrite->flush_rules(); is in terms of performance, you should never use it on init, a much better option is to just visit the Permalink options page, and save the changes a few times, that will flush them for you. – André L Jul 24 '12 at 11:50
Thank you both. – slick Jul 16 at 9:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.