Hello I'am getting this error on w3c because xmlns is deprecated.

How can I remove xmlns?

Attribute xmlns:fb not allowed here

<html lang="en-US" xmlns:fb="http://ogp.me/ns/fb#" xmlns:addthis="http://www.addthis.com/help/api-spec"  prefix="og: http://ogp.me/ns#">

My code is

<html <?php language_attributes(); ?>>
function get_language_attributes( $doctype = 'html' ) {
    $attributes = array();

    if ( function_exists( 'is_rtl' ) && is_rtl() )
        $attributes[] = 'dir="rtl"';

    if ( $lang = get_bloginfo('language') ) {
        if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
            $attributes[] = "lang=\"$lang\"";

        if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
            $attributes[] = "xml:lang=\"$lang\"";

    $output = implode(' ', $attributes);

     * Filters the language attributes for display in the html tag.
     * @since 2.5.0
     * @since 4.3.0 Added the `$doctype` parameter.
     * @param string $output A space-separated list of language attributes.
     * @param string $doctype The type of html document (xhtml|html).
    return apply_filters( 'language_attributes', $output, $doctype );

As you can see by the end of the get_language_attributes function there is a call to apply_filters. This allows themes and plugins to change the language attributes. In your case the two xmlns tags are added, one for facebook and one for addthis.

You will have to check your plugins which ones are doing this. Most likely, you have one that adds a facebook like button and add this sharing buttons. Find a more up to date plugin that uses the prefix attribute instead.

Or you could just leave it this way. xmlns is deprecated for this type of use, but it's not harmful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.