• Affected Version: 0.6.0

    Issue: The inserted <link> tag is missing a closing slash <link …/>

    Affected File: amp/includes/amp-frontend-actions.php:27

    Solution: The missing slash needs to be added to the printf command in the aforementioned file: '<link rel="amphtml" href="%s" />'

    Workaround: Add the following to the functions.php of your theme until it is fixed in one of the upstream releases.

    
    add_action( 'wp_head', 'afe_amp_frontend_add_canonical', 9);
    // fix missing end of html tag <link /> in amp plugin
    function afe_amp_frontend_add_canonical() {
            remove_action( 'wp_head', 'amp_frontend_add_canonical');
            if ( false === apply_filters( 'amp_frontend_show_canonical', true ) ) {
              return;
            }
    
            $amp_url = amp_get_permalink( get_queried_object_id() );
            printf( '<link rel="amphtml" href="%s" />', esc_url( $amp_url ) );
    }
    
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Malformed tag in HTML header’ is closed to new replies.