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
You 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.
}