Hot answers tagged

4 votes

wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/...
user avatar
  • 53.3k
1 vote
Accepted

Code to check how many posts a tag has?

You can use the found_posts property of the WP_Query class, to get the total number of posts in the queried tag (post_tag taxonomy), provided that the no_found_rows argument is not true: global $...
user avatar
  • 33.1k

Only top scored, non community-wiki answers of a minimum length are eligible