There is no good way to do this, but it can be done in a way. When you visit /category/ it serves it as though you are visiting a page called category. You can look for this like:
global $wp_query;
if ($wp_query->query_vars['pagename'] == "category")
{
// This is base category
}
else if ($wp_query->query_vars['pagename'] == "tag")
{
// this is tag base
}
But this should never be done. It is basically a junk query; a 404, and will send a 404 response code, so you will need to look at sending another response code. For that reason (if you decide to use it) this code should go in header.php although it could go high in 404.php (before any output).
Related Posts:
- Check if current category has subcategories
- wp_nav_menu not appearing for a couple pages
- wp_update_nav_menu_item() to insert categories
- How to get the url to tag & category base set by the user?
- Why adding Categories does not auto refresh in Backend while using my custom theme?
- is_archive() content being shown instead of is_category()
- Retrieve all posts within tag OR category?
- Edit the markup of categories list
- New Theme creation
- How to get data about category in category.php
- editing fonts of category links from the_category() funtion
- How to check category of of custom post type or not
- Set a them for all subset of category
- How to call custom category field data in theme?
- Different templates for different category tags
- Why category.php throw 404 in wordpress while calling paginate_links()?
- Woo Framework: woo_cat_featured not populating
- Inside a loop, how to change CSS class based on category name?
- Question on using custom structures for categories
- Getting the category title / description returns first matching post?
- Allow user to select categories that will display in post loop
- Insert HTML content in WP Query at specific point
- How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?
- Category page returns 404 error
- Show post categories
- Add description to categories menu in admin
- filter a loop base on specific category
- Problem with multiple loops in wordpress theme
- How to add icon over specific thumb
- How to differentiate the homepage structure from the category page structure in WordPress template?
- WooCommerce shared categories
- Show the number of the post
- Products category search not working
- In if…else condition, the else statement shows even if if statement is correct
- Can’t display posts by filtering categories using isotope.js
- Media Library Categories
- How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?
- Change single.php template based on parent category
- Show posts from all categories
- If it is a top level category show children otherwise show sibling categories
- Lowest catagory link
- How to get multiple loop in category.php, my scripts becomes madness
- Category base 404 – fix
- altering theme – content generated by PAGES not PORTFOLIO
- Category Archives: Show posts categorized in parent category only
- WordPress 3.5 how to determine if user is on category listing or category edit screen?
- Display only one level subcategory in wordpress
- How can i hide the authors box from a specific set of categories and post types?
- Get all first images of posts in same category
- How to display the category featured images [closed]
- How to make /category/ URL load properly instead of 404 error?
- Can I set a default featured image for a category?
- What’s the URL for a category archive?
- Weird behaviour when adding terms/term_taxonomies programmatically
- How can I get category ID by category name?
- Multiple level category drop-down
- Output link to category from WP_Query loop of woocommerce products
- Password protect a specific category page/post
- If in category to be inside of a function
- Different excerpt styles per category, but chronological
- Show only one category
- Pagination Not Working on Category.php page
- Filter Home Page Posts in Buddypress [closed]
- Broken category pagination
- Color different for the current category
- How to show post from category select
- one category template for multiple categories
- How can I define a custom archive for childs of a specific category?
- How do I toggle pagination on/off in search results and category listings via a link?
- Category shows only top level child categories
- Page display certain Category Posts
- REST API: Display Category names in JSON?
- List posts in alphabetical order
- Where is the category of a post stored?
- Add image to each podcast series (or category) in headless WordPress instance [closed]
- How to define multi categories posts number
- Trying to get variables in hacked category dropdown
- how to separate categories in loop.php?
- How can i remove the posts category class names from body_class
- Get posts of a custom post type from category from taxonomy?
- How can I ask to an existing category?
- Change categories count to include media attachments
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Show category meta in loop on homepage
- How can I check which archive has referred the single? [closed]
- How to hide widget from certain category
- Category link redirect to custom template page instead of index.php?
- Unable to browser posts in categories
- How to custom category template based on category?
- Inline If statement to echo CSS [closed]
- WooCommerce showing active product categories on single product page
- how to exclude specific category types (uncategorized) from blog page?
- Confused about category.php template – not working
- Adding relevant categories to related post
- How to assign image on specified category and not show the image on other categories
- How can I add a Categories page link to a menu? [closed]
- Way to show content of a post, but if exceeds character limit revert to excerpt?
- get posts from 2 categories. (2 posts)
- Converting Categories (with ACF fields) to custom taxonomies
- Why does my WordPress index has a category?