Skip to main content
1 of 2

How to set Custom Permalink for Taxonomy? (remove the slashes from term-slug)

I have my code to register my custom taxonomies.

function themename_custom_taxonomies() {
    // Coaching Method

    $coach_method = array(
        'name' => _x( 'Nieruchomość', 'taxonomy general name' ),
        'singular_name' => _x( 'Nieruchomość', 'taxonomy singular name' ),
        'search_items' =>  __( 'Szukaj nieruchomości' ),
        'all_items' => __( 'Wszystkie nieruchomości' ),
        'most_used_items' => null,
        'parent_item' => null,
        'parent_item_colon' => null,
        'edit_item' => __( 'Edytuj' ), 
        'update_item' => __( 'Zapisz' ),
        'add_new_item' => __( 'Dodaj nieruchomość' ),
        'new_item_name' => __( 'Nowa nieruchomość' ),
        'menu_name' => __( 'Nieruchomości' ),
    );
    $args = array(
        'hierarchical' => true,
        'labels' => $coach_method,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array('slug' => 'listings/?_prop=', 'with_front' => false)
    );
    register_taxonomy( 'nieruchomosc', array( 'nieruchomosc', 'ogloszenia' ), $args );
}

At this moment my taxonomy permalinks look:

https://example.com/listings/?_prop=/term-slug/

How can I change it for (without the slashes):

https://example.com/listings/?_prop=term-slug

Thank you in advance for help.