• 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 5 years, 2 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Developing with WordPress topic

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Yoast plugin link rel cannonical’ is closed to new replies.