0

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
1
  • Need a lot more details, what is it doing, etc. Commented Jun 16, 2020 at 1:42

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.