How can we know we are not in edit page
Use the following code in the functions.php file at your theme’s folder function my_enqueue($hook) { if ( ‘edit.php’ == $hook ) { return; } wp_register_script( ‘xxx’, get_template_directory_uri() . ‘/includes/js/slider.js’, array( ‘jquery’ ) ); wp_enqueue_script( ‘xxx’ ); } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ ); The admin_enqueue_scripts action hook can also be used to target a specific admin page.