{"id":33704,"date":"2013-06-06T18:25:59","date_gmt":"2013-06-06T12:55:59","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/?p=33704"},"modified":"2020-05-24T11:03:48","modified_gmt":"2020-05-24T05:33:48","slug":"add-canonical-urls-wordpress-blogs","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2013\/06\/add-canonical-urls-wordpress-blogs\/","title":{"rendered":"How to Add Canonical Urls to WordPress Blogs"},"content":{"rendered":"<p>It is very essential to add canonical URLs to every WordPress blog web page to avoid duplicate content penalties by search engines. <a href=\"https:\/\/webmasters.googleblog.com\/2009\/02\/specify-your-canonical.html\" target=\"_blank\" rel=\"noopener noreferrer\">Canonical URLs<\/a> represent the permalink of the page and help search engines identify and index the page, ignoring other parameters or mistyped URLs loading similar content.<\/p>\n<h2><span style=\"color: #ff0000;\">Add Canonical URLs Easily<\/span><\/h2>\n<h3><img decoding=\"async\" class=\"alignright size-full wp-image-33717\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/target-url.jpg\" alt=\"target canonical url\" width=\"200\" height=\"190\" \/>1. WordPress AutoInsert<\/h3>\n<p>The latest versions of WordPress automatically adds the canonical URL to the posts and pages only, but not to archives, tags, categories, etc. So while for most blogs, it takes care of all your single posts and pages, it does not fix canonical URL issues for your archives and other paginated categories\/tags.<\/p>\n<h3>2. SEO WordPress plugins<\/h3>\n<p>Popular SEO WordPress plugins like <a href=\"https:\/\/wordpress.org\/plugins\/all-in-one-seo-pack\/\" target=\"_blank\" rel=\"noopener noreferrer\">All in One SEO<\/a> or <a href=\"https:\/\/yoast.com\/wordpress\/plugins\/seo\/\" target=\"_blank\" rel=\"noopener noreferrer\">Yoast SEO<\/a> have options to set canonical URLs on all your blog pages and are the best way to add canonical URLs in on click.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-33710\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/canonical-url-plugins.png\" alt=\"canonical urls by plugins\" width=\"393\" height=\"99\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/canonical-url-plugins.png 393w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/canonical-url-plugins-300x75.png 300w\" sizes=\"(max-width: 393px) 100vw, 393px\" \/><\/p>\n<h3>3. Premium WordPress Theme Frameworks<\/h3>\n<p>Some advanced theme frameworks like <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2010\/04\/thesis-wordpress-theme-review\/\">Thesis<\/a> and <a href=\"https:\/\/www.quickonlinetips.com\/archives\/2012\/09\/genesis-wordpress-theme-framework-review\/\">Genesis<\/a> have SEO options that allow the auto setting of canonical URLs, without the use of above SEO plugins. However, they are paid WordPress themes, and most WordPress themes might not have options to set canonical URLs automatically.<\/p>\n<h3>4. Manual Code Addition<\/h3>\n<p>If for some reason you wish to add canonical URLs to all your single posts and pages manually, you can add the following code in the HEAD tags of your HTML code by editing <em>header.php<\/em><\/p>\n<pre><code>&lt;?php if (is_singular()) { ?&gt;\r\n&lt;link rel=\"canonical\" href=\"&lt;?php the_permalink() ?&gt;\" \/&gt;\r\n&lt;?php } ?&gt;<\/code><\/pre>\n<p>Similarly, if you want to add code manually to any page, you can simply add the canonical URL on the page in the HEAD tags. For example, we have a <a title=\"Canonical Url Errors with All-in-One SEO WordPress Plugin\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2009\/04\/seo-wordpress-plugin-drops-google-pagerank\/\">problem using SEO plugins<\/a> because we host WordPress in an alternative directory and the SEO plugins cannot create the correct URL for the front page. So we directly add our main front page canonical URL through a separate <em>index.php<\/em> file.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is very essential to add canonical URLs to every WordPress blog web page to avoid duplicate content penalties by&#8230;<\/p>\n","protected":false},"author":4,"featured_media":33717,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6],"tags":[49,17],"class_list":["post-33704","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging","tag-tutorials","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/33704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=33704"}],"version-history":[{"count":0,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/33704\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/33717"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=33704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=33704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=33704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}