Changing default wordpress taxonomy

Asked

Viewed 272 times

0

Currently the category pages of my site have the following taxonomy www.site.com/Category/program01; I cannot change this taxonomy to program/program01. Is there any way to make that change ?

  • Tried through the permalinks?

  • Yes but it is only possible to change the post’s Slug but not the category specific page

2 answers

0


1) You must change the label category, see the example:

<?php 

function change_category_taxonomy_label() {
        global $wp_taxonomies;

    $labels = $wp_taxonomies['category']->labels;

    if(!empty($labels)){
        $search = array('Categories', 'Category', 'category');
        $replace = array('Programa01', 'Programa01', 'programa01');

        foreach ($labels as $key => $label) {
            $label = str_replace($search, $replace, $label);
            $wp_taxonomies['category']->labels->$key = $label;
        }
    }
    $wp_taxonomies['category']->label = 'Programa01';

 }

 function jwh_manage_columns( $columns ) {
    $columns['categories'] = 'Programa01';
       return $columns;
}

function jwh_column_init() {
  add_filter( 'manage_posts_columns' , 'jwh_manage_columns' );
}
add_action( 'admin_init' , 'jwh_column_init' );

2) Or you can create a custom taxonomy. Just check the manual:

https://codex.wordpress.org/Taxonomies
  • Where should I add this function ? I tried to put in my theme functons but without success

  • This code is just an example, I have not tested it in my Wordpress. Yes, it should be used in the function file of your template.

  • I implanted in theme functions but it didn’t work

0

local para alterar a taxonomia das categorias e tagsAfter accessing the Wordpress admin panel, go to in Settings, then Permanent Links and then Optional change the basis of the categories. You can even do this with tags!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.