Add link rel="cannonical" to first page on archive... open

Add link rel="cannonical" to first page on archives. WordPress Code example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
1
function somarket_noindex_paged() {
	if ( is_paged() ) { ?>

		<link rel=”canonical” href=”<?php
		global $wp;
		$current_url = home_url( add_query_arg( array(), $wp->request ) );
		$s           = home_url( add_query_arg( array(), $wp->request ) );
		echo strstr( $s, 'page', true ); ?>" />
		<?php
	}
}

add_action( 'wp_head', 'somarket_noindex_paged', 2 );
0

More

Comments (1)

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation