Is there anyway to load a custom style in specific taxonomy pages?
for example these two pages:

wp-admin/edit-tags.php?taxonomy=news-category&post_type=news
wp-admin/term.php?taxonomy=news-category&..

I added a style to admin but other pager got edited too, how can we load the style when in these two pages of custom post type taxonomy?

2 Answers
2

You can do it like this:

add_action ('admin_enqueue_scripts', 'wpse_style_tax') ;

function
wpse_style_tax ()
{
    // these 3 globals are set during execution of {edit-tags,term}.php
    global $pagenow, $typenow, $taxnow ;

    if (!in_array ($pagenow, array ('edit-tags.php', 'term.php')) {
        return ;
        }
    if ('news' != $typenow) {
        return ;
        }
    if ('news-category' != $taxnow) {
        return ;
        }

    wp_enqueue_style ('wpse_my_handle', 'path_to_css_file', ...) ;

    return ;
}

Leave a Reply

Your email address will not be published. Required fields are marked *