Instead of:
home_url() . "/tag/" . $i->slug
Use get_term_link()
function. It will return the link for the term according with the current configuration:
// Assuming $i is a term object
get_term_link( $i->term_id )
For example, your printTags()
function would be:
function printTags($tags){
//Check to see if tags are provided
if ($tags!=false) {
$return = '';
foreach ($tags as $i){
$return .= '<li><a href="' . get_term_link( $i->term_id ) . '">' . $i->name . '</a></li>';
}
return $return;
}
}
Related Posts:
- How to get the url to tag & category base set by the user?
- Root level category, tag, author and archive pages to work
- How get permalink for the current category or tag?
- Changing permalink from /postname/ to category/postname/
- Tags Instead of Category
- Advanced permalinks structure
- How to add tags under categories
- Page Type with Category Link
- Remove parent category from permalink? Basically only have the child category?
- Category archive by year with permalink support /category/YYYY
- Add a URL prefix to permalinks of one category of posts only
- Control term order on a per-post basis
- Force WordPress to Show Pages Instead of Category
- How do I use the same post slug for different Categories?
- How to tax query X number of posts related by tag first, then by category if not enough in tag-related
- How to create a widgetized sidebar for every category dynamically?
- Automated adding of one tag to all the posts in a category
- Changing the category permalink structure
- Moving Categories submenu to Media, but still opens Posts menu
- When using get_categories or similar, is it possible to filter results that contain certain Tags as well?
- Exclude subcategories from the url
- Permalinks – Different structures for different categories?
- Script to duplicate categories as tags
- Removing category base form links messes up the parent-child behavior
- display most popular tags of category?
- Can paginate_links() be customized for a specific category or tag?
- Best way to programmatically link to multiple categories (union/intersection) [closed]
- How to set up Author archives with sub category URL
- How to filter posts by format and category via url?
- How to Filter categories in the permalink structure
- How can I duplicate categories and tags?
- Random post + categories + tags
- RSS/XML of all Categories and/or Tags
- Get Tags specific to Category using WooCommerce plugin
- Category being displayed without base parmalink
- wordpress sub-category ( lowercase letters + non-latin characters ) = 404
- Removing post category base giving Error 404
- The default code for “posts_nav_link” on category.php isn’t working
- Have different permalinks based on category
- Needing a snippet for listing category specific tags
- Same base for category and post
- How to list categories within tags?
- Hide uncategorized when no category set
- How to “group” (categorize) the Pages together?
- Is There a Difference Between Taxonomies and Categories?
- Remove subcategory and category with some rules from permalink
- Use Tag input metabox style for Categories
- WordPress URL Rewrite for dynamic and customized URL
- Custom SQL Query: Get all posts with category id and a concated list of tags on each post
- Get category URL knowing it’s id
- Have multiple category queries from the URL been fixed yet?
- How to get Next/previous_post_link to go through articles in top parent category
- Related Tags not in category
- How do I add a tag slug to a category URL to filter posts?
- Show the amount of posts in a tag in a specific category has
- How to Link to Most Recent Custom Post of Same Term
- Display all product tags associated with a specific product category
- How replace individual elements in the RSS feed with a single string
- Adding a H1 Tag to Post Tags automatically, but hide the tag? (Same for Category)
- Category url generate 404 error
- Conditional category & tag statement
- How to only show parent categories in sidebar
- Include either name or slug in the include parameter using wp_list_categories?
- How can I filter posts by tag on the fly
- How can I include custom category and tag base in template files?
- Categories show 404 error on multisite installation
- Custom menu with categories and tags
- A different permalink structure for different categories
- Is it possible to set up blog categories without changing permalink structure
- Remove WP Core canonical for category pagination
- echo $category[0]-> cat_name; shows only one category name
- When creating category, it creates automatically tag, or, when creating tag, it creates automatically category in same name
- Subcategory Page 404ing
- Using heirarchial tags or Custom taxonomies
- Print categories and most viewed articles
- Category and tag urls return 404 error
- How to echo Tags and Categories as plain text
- WordPress and “pretty permalink”
- How to exclude category and post_tag taxonomy while displaying custom taxonomy?
- 404 error when i try to search by category or by tag
- How to remove specific categories from tag archives?
- Group Posts by First Letter of Title categories
- Using categories and pages in menus
- A simple question regarding tags and categories
- hierarchical taxonomy in permalinks? using same slug
- Display related posts with same category or same tag return blank
- How can I allow people to ‘subscribe’ to categories?
- Changing Permalinks for Category Pages Only
- Loops in category description
- How to create a category or tag available exclusively to the admins and not to the users?
- Archives and category of authors
- Link categories to last post
- List products from current category
- How do I hide posts in a category from all listings but still allow the posts to be viewed?
- Custom permalinks structure
- Categories not shown on sidebar
- How to get category slug link? ( include parent categories)
- In my wordpress admin panel Suddenly The Category, tag and featured Image Option are not showing
- Use same wordpress category base and tags as the prefix as the post permalink
- Display different sidebar based on search results from one category