ワードプレスの style script要素、type属性を出力しないようにする。

The W3C Markup Validation Service などで、WordPressの投稿をチェックすると、以下のようなWarningが表示されます。

あったから、何か問題が出るわけでもありませんが、うっとうしい場合は、簡単に消すことができます。

The type attribute is unnecessary for JavaScript resources.

The type attribute for the style element is not needed and should be omitted.

テーマのfunctions.phpには、最近ではほとんどのテーマで、

		add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', ) );

HTML5のサポートが記述されていると思います。

WordPress5.3から、style,scriptが追加されましたので、style, scriptを追加すると、type属性は、出力されなくなります。 🙂

		add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
[emulsion_relate_posts]