Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //modifica a estrutura de permalinks das categorias. Ex: /category/subcategory/postname
- add_filter( 'category_link', 'new_category_link', 10, 2 );
- function new_category_link( $catlink, $category_id )
- {
- global $wp_rewrite;
- $catlink = $wp_rewrite->get_category_permastruct();
- if ( empty( $catlink ) ) {
- $catlink = home_url('?cat=' . $category_id);
- } else {
- $category = &get_category( $category_id );
- $category_nicename = $category->slug;
- $catlink = str_replace( '%category%', $category_nicename, $catlink );
- $catlink = home_url( user_trailingslashit( $catlink, 'category' ) );
- }
- return $catlink;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement