如何将我的脚本文件添加到wp_head的顶部?
在本指南中,使用下面的代码将始终将我的新脚本文件添加到最底层:
add_action('wp_head','hook_javascript');
function hook_javascript() {
$output="<script> alert('Page is loading...'); </script>";
echo $output;
}
Run Code Online (Sandbox Code Playgroud)
任何想法如何将我的新脚本文件移到顶部?
如何从 WP 标头中删除这两个链接?
<link rel='https://api.w.org/' href='http://xxx/wp-json/' />
<link rel="canonical" href="http://xxx/" />
Run Code Online (Sandbox Code Playgroud)
我不知道它们是做什么用的。它们对我来说只是显得多余。
是否可以?