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.