Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Yoast plugin link rel cannonical

$
0
0

Replies: 1

Hi,

I have a yoast plugin for seo and i want to add new hook like this:

add_filter( ‘wpseo_canonical’, ‘yoast_remove_canonical_items’ );
function yoast_remove_canonical_items( $canonical ) {
// here i want to check if specified part of template has results from query.
$postsCount = // here results of query
if ( $postsCount == 0 ) {
return $canonnical;
}

return false;
}

But i use different methods for gets results in template parts. Like get_posts() or new WP_query().

Is it possible to remove or add (modify) link rel cannonical after get_header()?

Maybe is any other way for this situation.

Ps: too much sorry for my English.

  • This topic was modified 9 minutes ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Developing with WordPress topic

Viewing all articles
Browse latest Browse all 59525

Trending Articles