Created
March 26, 2012 19:52
-
-
Save fritids/2209194 to your computer and use it in GitHub Desktop.
Modifier la structure url des profils auteurs en fonction de leur rôle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//http://www.geekpress.fr/wordpress/tutoriel/modifier-url-profils-auteurs-role-619/ | |
add_action( 'init', 'change_author_permalinks' ); | |
function change_author_permalinks() | |
{ | |
global $wp_rewrite; | |
// On définit un nouveau tag pour les rôles des auteurs | |
add_rewrite_tag( '%author_level%', '([a-z0-9]+)' ); | |
// On modifie la structure url de base des pages d'un auteur par notre nouveau tag | |
$wp_rewrite->author_base = '%author_level%'; | |
// On met à jour les règles de ré-écriture | |
$wp_rewrite->flush_rules(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment