Canonical URLs in Yoast SEO
Yoast SEO adds canonical URLs to most pages in your WordPress install. It does this automatically and in 99.9% of cases you don’t have to change anything about them. If you do want to change them, there are several ways of doing so:
Changing the canonical for an individual article (manually)
On the advanced tab of the Yoast SEO metabox, you can change the canonical to point to any URL:
Canonical elements for paginated archives
A common misconception is that the canonical on a paginated page should always point to page 1 in the series. This is not the case. When you do that, you run the risk of search engines not indexing links that appear on page 2, 3 etc. of your archives. This would cause older articles to drop out of the search results entirely.
Of course, you can change the canonical element of a category, tag or other taxonomy archive to point at another page. To do this, go into the taxonomies settings and set the canonical:
Filter the canonical element programmatically
If you want, you can also filter the output of the canonical programmatically. To do this you can use the
wpseo_canonical filter. If you return false on that, no canonical will be output. Some examples can be found here.