WordPress.org

Ready to get started?Download WordPress

Forums

Adding an XHTML namespace (xmlns) (4 posts)

  1. bottomlessinc
    Member
    Posted 4 years ago #

    From a plugin, how do you add a namespace?

    Example:

    Before:
    <html xmlns="http://www.w3.org/1999/xhtml">

    After:
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsi="http://example.org/schema/">

    Thanks

  2. Safirul Alredha
    Member
    Posted 4 years ago #

    You can use this if language_attributes() exists inside html tag.

    add_filter('language_attributes', 'schema');
            function schema($attr) {
                    $attr .= "\n xmlns:xsi=\"http://example.org/schema/\""; 
    
                    return $attr;
            }
  3. bottomlessinc
    Member
    Posted 4 years ago #

    Worked like a charm, thanks!

  4. Steve
    Member
    Posted 4 years ago #

    and if it doesn't?

Topic Closed

This topic has been closed to new replies.

About this Topic