How to change the url of a custom taxonomy in Wordpress?

My theme (Wordpress) has custom posts and taxonomy. I can add posts related to portfolio, services and slider category (custom taxonomy) and then the url looks like this:

www.heptasarim.com/ portfolio /my-portfolio.html

But I want to show url like this:

www.heptasarim.com/ Reference /my-portfolio.html

Website: heptasarim.com

Here's my custom post codes:

    //Slider post type registration
add_action('init', 'slider_register');

function slider_register() {
    $args = array(
        'label' => __('Slideshow'),
        'singular_label' => __('Slideshow'),
        'publicly_queryable' => true,
        'query_var' => true,
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'rewrite' => true,
        'supports' => array('title', 'editor', 'thumbnail'),
        'menu_icon' => get_template_directory_uri(). '/images/admin/slideshow.png',
    );

    register_post_type('slider', $args);
}

register_taxonomy("slidercatalog", array("slider"), array("hierarchical" => true, "label" => "Catalogs", "singular_label" => "Catalog", "rewrite" => true));
add_filter("manage_edit-slider_columns", "slider_edit_columns");
add_action("manage_posts_custom_column", "slider_custom_columns");

function slider_edit_columns($columns) {
    $columns = array(
        "cb" => "<input type=\"checkbox\" />",
        "title" => "Slider Title",
        "catalog" => "Catalog",
        "date" => "date",
    );
    return $columns;
}

function slider_custom_columns($column) {
    global $post;
    switch ($column) {
        case "description":
            the_excerpt();
            break;
        case "catalog":
            echo get_the_term_list($post->ID, 'slidercatalog', '', ', ', '');
            break;
    }
}

      

+3


source to share


1 answer


The permalink is defined by the slug, so you want to register it like this:



register_taxonomy(
    "slidercatalog", 
    array("slider"), 
    array(
        "hierarchical"   => true, 
        "label"          => "Catalogs", 
        "singular_label" => "Catalog", 
        "rewrite"        => true, 
        "slug"           => "referans"
    )
);

      

+2


source