If the URL being “hard-coded” is the problem you can use get_category_link
foreach((get_the_category()) as $cat) {
if ($cat->cat_ID !='12')
echo '<a href="'.get_category_link($cat->cat_ID).'"> | ' . $cat->cat_name . '</a>';
}
Related Posts:
- Exclude category from category archive
- Exclude Categories from wp_list_categories()
- List post wit the same category but exclude parent
- Display 1 category only with get_the_category (by ID or slug)
- Get first category only and excluding one
- exclude category from get_posts?
- Exclude the category from the WordPress loop
- Exclude certain category from latest updates
- Exclude categories from Loop, queries, widgets, post navigation
- List posts by category exclude current post
- wp_list_categories exclude not working
- How to filter by category in REST API, excluding posts also in other category term?
- Exclude Tags from get_the_tags
- Excluding a category from next and previous post links
- is there a quick way to hide category from everywhere?
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- How to exclude categories from recent posts, recent comments & category widgets?
- Exclude a category from the filed under list only on some templates
- How to set post expiration date and time and move the page to archive after expiration [closed]
- How to exclude posts from a category when using this particular format
- Exclude category from Tag Template
- exclude post from displaying in loop if it is in a category, but not in many categories
- I need to create a search form that will display search results from specific category
- Exclude Posts From Specific Category from Next and Previous post links
- Query Posts Exclude Entire Category
- exclude categories from search results
- Exclude category from fucntion
- WordPress category widget only show categories with children
- Exclude Category filter from Portfolio section
- Multiple arrays in post__not_in parameter
- Excluding posts not working
- wp_list_pages() exclude category
- Include posts from some categories while excluding from others
- Loop doesn’t exclude the specified category in home page
- How do I remove a category from a wordpress loop>
- Exclude category from query
- Functions.php: Exclude Category from “Blog”
- Exclude Category ID in function
- Woocommerce filter function not updating
- How to get post with slug and exclude categories
- wp_list_categories not excluing multiple ids
- Exclude post category in a blog page
- How to exclude posts from category posts count
- Exclude category from foreach loop
- Have posts that belong to multiple categories, exclude some categories from homepage
- Exclude all subcategories in the_category (post)
- Exclude some categories from the post page
- Exclude category from get_the_category
- I need to exclude from a query a category and a few custom taxonomies
- Exclude categories by ID
- Don’t execute function on specific posts
- WooCommerce Hiding A Certain Category From Being Displayed On Single Product
- using pre_get_posts to exclude
- Homepage custom recent news
- problems exluding categories
- Exclude the category in WordPress
- How can I exclude a category from the main loop with the category name & not ID?
- User level categories
- Exclude category from drop down list form
- Disable the link on certain pages
- exclude certain categories form archive widget
- Exclude Woocommerce Product Category From Sitemap
- How to remove an item from a custom Walker_Nav_Menu
- Exclude a category and post_type from wp_query
- Exclude category and post from loop in custom category.php
- How can I exclude a particular category from my WordPress Page 1 and Page 2?
- Excluding category from post navigation in WordPress?
- post__in and tag__not_in conflict
- Exclude category from WP_Query args not working
- Displaying Category in sidebar post widget but not in the loop on home
- How to exclude one category
- How to exclude a category in the following Code?
- Category menu that filters out empty categories
- trouble with my loop
- Problems with explode [closed]
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- How to have a category not show up in query post with page panigation?
- Customize category query in widget
- Exclude a ‘portfolio’ custom category?
- Call function on a single page
- Excluding cateory not working on my site. how to solve this? [closed]
- How to define category ID in an array?
- hide particular category post from front page only [closed]
- Exclude a category ID from the following function
- Get all categories and posts in those categories
- Is it possible to put tags and category information in the post as text?
- how to get the categories for a single post in a hierarchical way
- How to build a simple nav system of custom post type categories and its posts?
- Loading Posts & Category with Ajax
- Subcategory Page URL to Display Only Posts from that Subcategory?
- Add Custom Category Description When Empty
- Some subcategories not working on custom portfolio sort
- Link For Portfolio Categories
- Loop Through Categories in Custom Field
- Category archive in menu
- Multiple Categories under one URL, where ‘Front Page’ is used already
- finding out the top 5 source ( source is a custom taxonomy ), in a given category
- Remove slug from Custom Category Permalink + dual-category permalinks
- how to implement next/prev within category archive?
- Replace category titles inside RSS feed