• The canonical link is also important for SEO things, so it would be great to extend parsed response with <link> tags.
    Probably it could be easily achieved by extending the parser function with something like this.

    $links       = $dom->getElementsByTagName( 'link' );
            $yoast_links = [];
            foreach ( $links as $link ) {
                if ( $link->hasAttributes() ) {
                    $yoast_link = [];
                    foreach ( $link->attributes as $attr ) {
                        // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
                        $yoast_link[ $attr->nodeName ] = esc_html( wp_strip_all_tags( stripslashes( $attr->nodeValue ), true ) );
                    }
                    $yoast_links[] = $yoast_link;
                }
            }
    • This topic was modified 3 years, 2 months ago by ikoshele.
  • The topic ‘Add tags to the yoast head parser’ is closed to new replies.