You can review the explanation here to include any script here
function my_enqueue($hook) {
if( 'edit.php' != $hook )
return;
wp_enqueue_script( 'my_custom_script', plugins_url('/myscript.js', __FILE__) );
}
add_action( 'admin_enqueue_scripts', 'my_enqueue' );
The above code will add the script in all your admin pages.
In order to identify the page you may follow this:
if (isset($_GET['page']) && $_GET['page'] == 'wp-accordion') {
// do all of your add_action() hooks here
}
Here “page” is the get variable which you defined in your created plugin while adding menus.
I hope you find my answer useful.
Related Posts:
- Correct way to enqueue jquery-ui
- How Do I Use jQuery UI In My Plugin
- How do I implement a jQuery UI dialog modal in a WP plugin?
- jQuery UI tab does not work in the plugin page
- Open tab on current day problem jQuery and WordPress
- wp_enqueue_scripts in a plugin’s class
- jQueryUI draggable doesn’t work in WordPress plugin
- How react js and other Javascript Technologies works on WordPress plugin?
- Plugin – create a page without it appearing in the side menu
- Is wp-content/install.php a Drop-in?
- Using wp_filesystem in Plugins
- How to write testable classes in WordPress
- get_template_part from plugin
- Edit or Remove Plugin .htaccess Using The Admin Panel
- WordPress REST API call generates nonce twice on every call
- WordPress scheduled task is called but not executed
- How to create collections that are edited in admin?
- Filters ‘request’ and ‘parse_query’ not firing in sites.php nor link-manager.php
- How to trap “Publish” button to check for meta box validation?
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- wp_mail not recognizing cc and bcc headers
- How can I call “preview post” from wp_remote_get with authentication?
- When is it too late to call the action wp_enqueue_scripts?
- Use js script from one plugin in another plugin
- Plugin Loading Scripts and Styles on Every Page – Even when not being used
- Build dynamic page from cURL (HTML page) response with plugin
- How to store accumulate multiple option values in a single array using Options_API
- template_redirect for single posts w/ custom fields
- can I prevent WP users (even admin) from deleting custom categories?
- Backslashes being stripped from CSS
- Uploading images from a custom page using blueimp uploader?
- Extending WP_List_Table seems getting wrong with $this->get_columns() – what’s wrong?
- Why doesn’t flush_rewrite_rules run on plugin activation?
- Finding posts containing matching array elements in a meta field usign WP_Query
- how to use hook deleted_user into custom function to delete user from custom table
- Namespaced action and filter tags
- Adding Dropbox dropin js using wp_enqueue_script
- Proper way to pass credentials in a custom login form to avoid “headers already sent”
- Single sanitization callback for multiple fields
- How to filter users list on user_status field with get_users()
- WordPress Multisite with Azure B2C redirect_urls after Login
- How to add custom fields to the all users page
- Can Page Templates be Applied to Archive and Post Templates?
- WooCommerce Admin Reports : Get custom product report based on date range
- Auto gallery from folder contents
- Adding (blog-specific) links to “My Sites” admin page
- Is there a plugin that will allow a tag cloud to be created from any mysql field?
- How to enable sorting in custom media uploader in plugin
- Custom login doesn’t work properly
- Unit testing a plugin with a theme dependency
- Translate slug in WPMU with PO files
- Allow users to add / remove settings in plugin
- Update problem with update_option() in combination with register_setting()
- Why does my widget break other widgets?
- How do I add a text field under the activity texarea? [closed]
- Help writing custom function with rewrite endpoint that generates a page from dynamic content
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- Function/Class to list categories with checkboxes
- Is it possible to enable and disable wp debug from functions.php?
- Default settings aren’t used
- Getting a WordPress Debug Strategy
- Best way to include and use Zoho SDK in a wordpress plugin
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Is hint for translator compulsory while internationalizing a string containing variables?
- How remove trashed WooCommerce orders from wc_get_orders() result?
- How to use nonce
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Does WordPress default CSS have Grids?
- Unexpected T_FUNCTION
- How to avoid conflicts with db.php / $wpdb and other plugins that decide to use them?
- Plugin can’t be activated [closed]
- Is there an action_filter hook to add content before the post title?
- CSS not being applied using wp_enqueue_style
- Make a php array load faster
- Count products with custom metadata field in an order
- setTimeout not working in jquery
- Hide / show settings field based on other field’s value
- Woocommerce Product finder feature on home page
- How do I show the HTML descrption in wordpress photo gallery for my individual gallery pages?
- Two same AJAX calls – one is working, other doesn’t
- Adding and handling custom settings tab to fusion element
- WordPress Reset password Strength set to medium
- Add language localisation to javascript alert?
- redirect_to how to make it simply work with get parameter or similar?
- How to get option values without requiring wp-load?
- How I can give access to my custom plugin for editor roles user?
- Problem with baseurl and interaction with plugin
- Why setcookie function redirecting to home page in wordpress?
- Should all roles be allowed CRUD operation on the database?
- Associating special meaning with user id 0
- Filter get_user_by instead of replace function
- WP: adding Javascript to specific woo commerce pages
- Downloading Generated XML File
- How to create a custom search form and handler?
- How to use permalink query to go to specific tabs in posts
- Conditional query tags do not work before the query is run. Before then, they always return false
- Method to retrieve category names and IDs only as an array?
- Send Webhook when post-status is publish or trash
- Using “add_image_size” to register custom image sizes inside plugins not working
- How do I access the contents of WordPress Classic editor in admin area with JavaScript?