admin管理员组文章数量:1333674
When I add this code to my theme's functions.php
file, it crashes my admin panel. How can I prevent it from loading in the admin screens?
//add_action('init', 'hekim_sticky_header');
// I want load this only if it is not admin panel
When I add this code to my theme's functions.php
file, it crashes my admin panel. How can I prevent it from loading in the admin screens?
//add_action('init', 'hekim_sticky_header');
// I want load this only if it is not admin panel
Share
Improve this question
edited Jun 16, 2020 at 2:53
Pat J
12.4k2 gold badges28 silver badges36 bronze badges
asked Jun 16, 2020 at 1:24
Javascript Asking AccountJavascript Asking Account
51 bronze badge
1
- Need a lot more details, what is it doing, etc. – Tony Djukic Commented Jun 16, 2020 at 1:42
1 Answer
Reset to default 1You can use the is_admin()
function to check:
add_action( 'init', 'hekim_sticky_header' );
function hekim_sticky_header() {
if ( is_admin() ) {
return;
}
// Rest of your function goes here.
}
本文标签: actionsHow can I prevent a function from loading in the admin screens
版权声明:本文标题:actions - How can I prevent a function from loading in the admin screens? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742346378a2457603.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论