Yes, your code is good.
And that my_custom_script is a unique identifier for the script you’re enqueueing. You can find the default script handlers/identifiers here — e.g. jquery for the jQuery library that ships with WordPress.
There you can also find more details about the wp_enqueue_script() function, e.g. where should you use the function, the parameters, etc.
Related Posts:
- Which hook to use when adding ajax to viewer-facing side?
- Move jQuery on *top* of footer
- Hook with jquery script is not working in wp-admin [closed]
- Using jQuery to delete data stored in wp_options
- WordPress admin notice in plugin function
- Fire jQuery function when post edit screen loads
- Restrict access to admin but allow admin_post hook
- How to Use JSON With AJAX?
- Use latest jQuery in WordPress (admin interface)
- Using wp_ajax and wp_ajax_nopriv hooks
- Remove “Get Shortlink” button in admin of custom post type
- Admin wp_ajax hook returning 0
- Edit single attachment on click (WP-admin)
- Adding a character counter to the excerpt metabox
- WP Admin missing icons, numerous JavaScript errors, but only when SCRIPT_DEBUG is false
- ‘wp_login’ action hook not working with wp-login.php file
- Returning content via jQuery without footers on admin pages
- Can’t load a class into WordPress post editor’s content field
- Unable to uncheck checkbox with jquery in wp admin
- Hide metabox dependant on page template chosen
- jQuery is missing in wp-admin
- Exclude some scripts from removing unique scripts from head function
- Bypass nonce value while trashing a post
- Add/remove action on jQuery toggle
- wp_dequeue_script not working in my plugin
- How to isolate code to the post edit screen
- ‘wp’ hook supposed to trigger when editing a post?
- jQuery does not work
- How to fix my old theme so it loads jQuery properly
- Admin side jquery is not loaded
- Using Foundation 5 in WordPress Administration Area
- change order of add_action hooks for jquery to be loaded first
- Plugin Scripts no loading on options page
- Notice-Updated div moving around unprompted
- How do I add something to the “Edit Tag” page in wp-admin?
- Applying jquery to WordPress admin edit.php
- Is there a default way in wordpress to create a overlay in the dashboard?
- Screen Options JavaScript Code
- Query String Link With Anchor Tag Not Working on Same Page
- Fire action after enqueue script
- What is the earliest Hook a Script can use?
- Add JQuery As Code Snippet
- how to do display: block after user login
- Check get_post value after wp-admin login
- Dashboard controls have all stopped working
- Is not using admin-ajax to ajax submissions okay?
- Add a jQuery snippet for sepcific user role
- I can’t enqueue Suggest.js in frontend – not added
- $_POST empty in using new php file added to theme
- Custom button on admin page doesn’t trigger click event
- Uncaught TypeError: undefined is not a function (shortcode-box)
- Customize wp-admin form custom fields
- JQuery multiple toggle values
- jQuery .change() Event Bubbling in WP Admin
- jQuery datepicker not showing on admin menu
- Override default options in plugin metaboxes
- JavaScript sleep/wait before continuing [duplicate]
- JSON parsing error syntax error unexpected end of input
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- How do I link a JavaScript file to a HTML file?
- What does [object Object] mean? (JavaScript)
- jQuery $(this) keyword
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- How to set time delay in javascript
- Disable button in jQuery
- jQuery $(this) keyword
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- Disable button in jQuery
- JavaScript error (Uncaught SyntaxError: Unexpected end of input)
- How to wait 5 seconds with jQuery?
- Submit a form using jQuery
- How to Handle Button Click Events in jQuery?
- How to enable CORS in flask
- How can I get the ID of an element using jQuery?
- jQuery equivalent of JavaScript’s addEventListener method
- Should I use .done() and .fail() for new jQuery AJAX code instead of success and error
- Pass request headers in a jQuery AJAX GET call
- $.ajax – dataType
- what does jQuery data() function do
- How to show loading spinner in jQuery?
- How can I get the ID of an element using jQuery?
- What is content-type and datatype in an AJAX request?
- jQuery Selector: Id Ends With?
- speedtest.net api
- jQuery dialog popup
- data.map is not a function
- How do you select a particular option in a SELECT element in jQuery?
- Set select option ‘selected’, by value
- Change Placeholder Text using jQuery
- Adding placeholder attribute using Jquery
- jQuery Ajax error handling, show custom exception messages
- How to send multiple data fields via Ajax?
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- Jquery change background color
- My javascript is returning this error: $.ajax is not a function
- Best way to store a key=>value array in JavaScript?
- jQuery if div contains this text, replace that part of the text
- Javascript Runtime error: $ is undefined
- Bootstrap – Uncaught TypeError: Cannot read property ‘fn’ of undefined