有些强迫症的站长希望去除WordPress后台的LOGO,这里我们当然可以将LOGO的路径换成我们自己的,或者直接用下面的代码实现。
<span class="com">/*** 去除WP后台LOGO* https://www.cnwper.com/remove-wplogo.html*/</span><span class="kwd">function</span><span class="pln"> cnwper_admin_bar_remove</span><span class="pun">()</span> <span class="pun">{</span><span class="kwd">global</span><span class="pln"> $wp_admin_bar</span><span class="pun">;</span><span class="pln">$wp_admin_bar</span><span class="pun">-></span><span class="pln">remove_menu</span><span class="pun">(</span><span class="str">'wp-logo'</span><span class="pun">);</span><span class="pun">}</span><span class="pln">add_action</span><span class="pun">(</span><span class="str">'wp_before_admin_bar_render'</span><span class="pun">,</span> <span class="str">'cnwper_admin_bar_remove'</span><span class="pun">,</span> <span class="lit">0</span><span class="pun">);</span>/** * 去除WP后台LOGO * https://www.cnwper.com/remove-wplogo.html */ function cnwper_admin_bar_remove() { global $wp_admin_bar; $wp_admin_bar->remove_menu('wp-logo'); } add_action('wp_before_admin_bar_render', 'cnwper_admin_bar_remove', 0);
我们将代码添加到当前主题 Functions.php中。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
相关文章
暂无评论...