in a category archive, the code could be:
echo get_category_link(get_query_var('cat'));
in a tag archive, this could be:
if(is_tag()) echo get_term_link(get_query_var('tag'), 'post_tag');
the conditional was added to avoid an error messages if not in a tag archive.
Related Posts:
- How to check if I’m on the last page of posts?
- Multisite – Protect categories from deletion?
- Where/how are categories stored?
- Get top parent category
- wp_update_nav_menu_item() to insert categories
- Redirecting specific category posts to subdomain
- How can I prevent users from creating new categories?
- Get child categories when clicking on parent category
- Custom color for each category name
- Block multiple categories from Blog
- Best and Cleanest way to remove /category/ from category permalinks? [duplicate]
- Categories list loop – add separator every year
- Wrap a chosen category name with div
- What type of page should i use? static page or category page? and what’s the difference? [closed]
- Category tree is flattened inside admin upon saving
- Get woocommerce catogry
- Categories vs. Page Site Organization
- Get last post date yesterday from each categories not work & double result post
- How do I add a function on a specific post category?
- Open subcategories in submenu on click in primary menu
- How to add Categories to the top menu of the website?
- Multiple categories PROBLEM and Duplicating main categories
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- Retrieve Image from Media Library by it’s category
- Getting URL of archive (category) page
- Strip a word from wp_list_categories
- Get Unique Categories – Group By?
- Site search needs to find posts for category topic AND Tag or keyword thats not in the post
- Get category url in loop
- Previous/next post links displaying wrong category than is desired
- SQL to migrate post types to taxonomy
- category url structure
- Order by category titles
- How to conditionally hide author name on Single.php if category is “news”, otherwise if category is something else display author name?
- How to let users choose posts order in categories?
- WordPress category
- Different Output for “Every Other” Foreach Statement?
- And/Or Category Query
- Automatically redirect a page to a category that share the same slug
- Show subcategories on a parent category page
- How do I add Category Body Classes to Admin?
- not all categories being displayed
- Category archive is displaying all posts rather than the specific category
- Use the category name instead of category slug in permalinks
- How can I display the number of post associated to a category in Twig/Timber WordPress? [closed]
- How to display the parent category if only the child category has been chosen
- Multiple Category Search with and operator in WordPress
- get_posts() from parent category only using a shortcode
- Display list categories from CTP
- Different CSS class by category
- Remove any product that is featured from regular display loop [WooCommerce]
- Latest updated categories list query, exclude one from displaying
- How the posts and categories connected each other in wp 4.1.1?
- How to restrict the amount of categories/post tags/terms for a post type post
- More efficient way to list posts by category [duplicate]
- Getting parent category hierarchy as objects from category template
- Ordering categories by slug vs. name
- Using in ‘category_name’ in ‘$query->set();’?
- Change appearance based on category but post is in two main categories
- how can i hide category?
- Homepage custom recent news
- post_class remove tag- or category- from slug
- creating categories programmatically
- Pagination for a category
- Custom url structure – pages under a custom post type
- Assign a list of categories with a parent category
- Custom post type archive category page results in 404
- What is the best way to add an advanced / intermediate / beginner tag to a post
- Is there a “sensible” limit to WordPress Categories?
- Possible to make get_categories() hide_empty attribute honor excludes from post query?
- Display Category Name and Date Posted on Blog Post
- Modifying category order
- How to remove “Categories:” part after the post title? [closed]
- Please tell how to stop the category from showing up on posts
- Editing categories crashes WordPress site
- Remove “category” from permalink with add_rewrite_rule
- Next and previous links category infinite loop
- Conditional Site Logo(Category Based)
- show only terms from parent category
- Tag Menu items based on their categories
- Accessible Subcategory URL’s pages without using .php hack
- How to display total views of all posts of one category?
- in_category(‘category-sluga’) returns true for Archive page of Category ‘category-slugb’
- wp_list_category only showing to logged in uers
- Grouping parent categories into sections
- How to show “category” name?
- Querying Multiple Categories With Different Offsets
- filter single_cat_title avoiding the breadcrumbs
- htaccess redirect for all categories converted to tags now showing 404
- altering theme – content generated by PAGES not PORTFOLIO
- Category page with gallery for each post
- (WordPress) How to get custom taxonomy parent name?
- How do i add custom post types to this query?
- add new input field like category?
- WordPress excerpt for specific posts in category
- How do I get a single page navigation depending on the previous page?
- Search functionality with multiple categories
- Make a menu visible for a single category and it’s content
- How to define category ID in an array?
- Restricted category in Woocommerce [closed]