'How to change the user declared canonical link in yoast SEO?

Many of my website's pages were not indexed. When searched in Google search console, there was an error which said: "Duplicate, submitted URL not selected as canonical."

In the user declared canonical URL, it has mentioned the http url, while I'm trying to index the https version.

I tried changing the user declared canonical to https version through yoast seo plugin but even then when i try indexing the https version, google says duplicate content and still shows the http version as the user declared canonical.

Can someone help me out here?

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source