register taxonomy – Broken links on terms list page


I’ve registered a custom taxonomy for a custom post type. Every term on the admin term list page has a link to the list of posts filtered by that term.

enter image description here

This link should look like this:

for a custom post type:


for posts:


However, for my taxonomy the links do not have the post_type argument, resulting in links like .../edit.php?taxonomy-name=taxonomy-term-name which makes the links lead to regular posts list filtered by a term of a taxonomy they don’t have. I can’t figure out why this is.

My code:

//register a post type in a plugin
add_action( 'init', 'register_post_type_tdlrm_store_item', 10 );
function register_post_type_tdlrm_store_item() {
    $labels  = array(
    $args = array(
        'label'                 => __( 'Item', 'text_domain' ),
        'description'           => __( 'Store items', 'text_domain' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions' ),
        'taxonomies'            => array( 'store-category' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => false,
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-cart',
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,
        'exclude_from_search'   => false,   
        'publicly_queryable'    => true,
        'capability_type'       => 'post',
        'rewrite'               => array('slug' => 'product')

    $args = apply_filters('tdlrm_filter: tdlrm_store_item: alter register_post_type arguments', $args);

    register_post_type( 'tdlrm_store_item', $args );


//register taxonomy in another plugin
add_action( 'init', 'register_ingredients_taxonomy', 99);
function register_ingredients_taxonomy(){
        $labels = array(

        $args = array(
            'labels'            => $labels,
            'hierarchical'      => true,
            'public'            => true,
            'show_ui'           => true,
            'show_admin_column' => true,
            'show_in_nav_menus' => true,
            'show_tagcloud'     => false,
            'rewrite'           => array( 'slug' => 'ingredient' ),

        register_taxonomy( 'tdlrm_ingredients', array( 'tdlrm_store_item' ), $args );

//I tried to fix the situation
add_filter('tdlrm_filter: tdlrm_store_item: alter register_post_type arguments', 'alter_post_type_arguments');
function alter_post_type_arguments($arguments){
        if(!in_array('tdlrm_ingredients', $arguments['taxonomies'])){
            $arguments['taxonomies'][] = 'tdlrm_ingredients';

        return $arguments;

I don’t understand why this gives me wrong links.
Also, I have re-saved permalinks just in case, to no effect.

Artem 2 months 2023-02-07T23:37:30-05:00 0 Answers 0 views 0

Leave an answer