{"id":366,"date":"2017-07-18T05:42:37","date_gmt":"2017-07-18T05:42:37","guid":{"rendered":"http:\/\/emacslisp.com\/?p=366"},"modified":"2017-07-18T10:14:42","modified_gmt":"2017-07-18T10:14:42","slug":"wordpress-analysis-wp_admin_cssinstalltrue","status":"publish","type":"post","link":"http:\/\/emacslisp.com\/?p=366","title":{"rendered":"WordPress &#8211; analysis wp_admin_css(&#8216;install&#8217;,true);"},"content":{"rendered":"<p>as we know css is key role for web page,<\/p>\n<p>wordpress using <strong>wp_admin_css(&#8216;install&#8217;, true);<\/strong> to print link css.<br \/>\nin format of &lt;link href=&#8217;&#8230;\/xxx.css&#8217;&gt; <\/p>\n<p>the most important statement.<\/p>\n<pre lang=\"php\" line=\"1\"> \r\n$tag = apply_filters( 'style_loader_tag', \"<link rel='$rel' id='$handle-css' $title href='$href' type='text\/css' media='$media' \/>\\n\", $handle, $href, $media);\r\n<\/pre>\n<p>&#8220;&lt;link rel=&#8217;$rel&#8217; id=&#8217;$handle-css&#8217; $title href=&#8217;$href&#8217; type=&#8217;text\/css&#8217; media=&#8217;$media&#8217; \/&gt;\\n&#8221; will be replaced<br \/>\nto be &#8216;&lt;link rel=&#8217;stylesheet&#8217; id=&#8217;install-css&#8217;  href=&#8217;http:\/\/localhost:8082\/wordpress2\/wp-admin\/css\/install.min.css?ver=4.7.2&#8242; type=&#8217;text\/css&#8217; media=&#8217;all&#8217; \/&gt;<\/p>\n<p>Let&#8217;s look at what define of apply_filters, &#8220;apply_filters($tag,$value)&#8221;. &#8216;style_loader_tag&#8217; has nothing in global variable $wp_filter.<\/p>\n<p>Therefore, apply_filters do nothing here, it only return second param as string to print.<\/p>\n<pre lang=\"php\" line=\"1\"> \r\necho $conditional_pre;\r\necho $tag;\r\n$this->print_inline_style( $handle );\r\necho $conditional_post;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>as we know css is key role for web page, wordpress using wp_admin_css(&#8216;install&#8217;, true); to print link css. in format of &lt;link href=&#8217;&#8230;\/xxx.css&#8217;&gt; the most important statement. $tag = apply_filters( &#8216;style_loader_tag&#8217;, &#8220;\\n&#8221;, $handle, $href, $media); &#8220;&lt;link rel=&#8217;$rel&#8217; id=&#8217;$handle-css&#8217; $title href=&#8217;$href&#8217; type=&#8217;text\/css&#8217; media=&#8217;$media&#8217; \/&gt;\\n&#8221; will be replaced to be &#8216;&lt;link rel=&#8217;stylesheet&#8217; id=&#8217;install-css&#8217; href=&#8217;http:\/\/localhost:8082\/wordpress2\/wp-admin\/css\/install.min.css?ver=4.7.2&#8242; type=&#8217;text\/css&#8217; media=&#8217;all&#8217; \/&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-366","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"_links":{"self":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/366","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=366"}],"version-history":[{"count":10,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/366\/revisions"}],"predecessor-version":[{"id":376,"href":"http:\/\/emacslisp.com\/index.php?rest_route=\/wp\/v2\/posts\/366\/revisions\/376"}],"wp:attachment":[{"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=366"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=366"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/emacslisp.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=366"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}