WordPress Redirecting Non Category Pages /page/nnn to their Canonical URLs

This is by design and intentional. WordPress rewrites have become increasingly complex over the years, and many plugins utilise the page endpoint for a page (usually with a template and custom query) – redirecting introduces a potential world of pain. Long story short, it doesn’t matter anyway. WordPress adds <link rel=”canonical /> for pages, so … Read more

Pagination url canonical problem

You have to install Yoast SEO and then add to functions.php: function return_canon () { $canon_page = get_pagenum_link(1); return $canon_page; } function canon_paged() { if (is_paged()) { add_filter( ‘wpseo_canonical’, ‘return_canon’ ); } } add_filter(‘wpseo_head’,’canon_paged’);

Setting custom canonical urls

It depends on how your canonical URLs are being written to the page. In your theme’s header you may find something like: <link rel=”canonical” href=”https://wordpress.stackexchange.com/questions/331598/<?php echo get_permalink(); ?>”> If you are able to edit your theme (or child theme if using a distributed theme) you can put whatever you want there instead. For instance, you … Read more

add the post as canonical for attachment page wordpress

Here’s an (untested) example where we inject into the header tag on attachment’s pages, the canonical link of the attached post: add_action( ‘wp_head’, ‘wpse_attachment_parent_canonical’ ); function wpse_attachment_parent_canonical() { // Only target attachment’s pages if( ! is_attachment() ) return; $object = get_queried_object(); // Make sure we’re dealing with a WP_Post object if ( ! is_a( $object, … Read more

Why isn’t the canonical link element used for all pages?

It’s not like every single page is magically better with canonical link. The technical purpose of canonical link is to de–duplicate identical or nearly–identical content at different URLs. It doesn’t make sense for archives because they are : collections of content moving target, what is on front page or archive right now won’t be there … Read more

How to bulk edit canonical url’s in SQL?

Down- and uploading CSVs is a tough one that forces you to make a bunch of steps manually which is prone to human error (and typos). My suggestion would be to do something that you can battletest locally in a local copy of your DB. Steps to follow: Make a database dump using the mysqldump … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)