teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

2

2017/10/02 06:58

投稿

退会済みユーザー
answer CHANGED
@@ -18,4 +18,13 @@
18
18
  return str_replace( " id='freesiaempire-style-css' ", '', $html );
19
19
  }
20
20
  add_filter( 'style_loader_tag', 'hide_style_id' );
21
+ ```
22
+ **複数の場合**
23
+ ```
24
+ function hide_style_id( $html ) {
25
+ $html = str_replace( " id='freesiaempire-style-css' ", '', $html );
26
+ $html = str_replace( " id='hogehoge' ", '', $html );
27
+ return $html;
28
+ }
29
+ add_filter( 'style_loader_tag', 'hide_style_id' );
21
30
  ```

1

2017/10/02 06:58

投稿

退会済みユーザー
answer CHANGED
@@ -6,4 +6,16 @@
6
6
  自作か否か、配布されている物ではないのでどちらかと言えば自作になるかと。
7
7
  でも作ってもらった物の方が正しいと思います。
8
8
  Communications
9
- [http://www.current-com.com/](http://www.current-com.com/)
9
+ [http://www.current-com.com/](http://www.current-com.com/)
10
+
11
+ **追記**
12
+ そのプラグインでIDが消せるかどうか忘れましたが、CSSのIDを消すだけならプラグインを使わなくても```style_loader_tag```で非表示にできます。
13
+ style_loader_tag
14
+ [https://developer.wordpress.org/reference/hooks/style_loader_tag/](https://developer.wordpress.org/reference/hooks/style_loader_tag/)
15
+
16
+ ```
17
+ function hide_style_id( $html ) {
18
+ return str_replace( " id='freesiaempire-style-css' ", '', $html );
19
+ }
20
+ add_filter( 'style_loader_tag', 'hide_style_id' );
21
+ ```