Advertisements

rel_canonical

Definition:
function rel_canonical() {}

Output rel=canonical for singular queries.

Source code

function rel_canonical() {

	if ( !is_singular() )

		return;



	global $wp_the_query;

	if ( !$id = $wp_the_query->get_queried_object_id() )

		return;



	$link = get_permalink( $id );

	echo "<link rel='canonical' href='$link' />\n";

}

2697

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: