how to add script in wordpress admin page

Solutions on MaxInterview for how to add script in wordpress admin page by the best coders in the world

showing results for - "how to add script in wordpress admin page"
Debora
21 May 2019
1/**
2 * Enqueue a script in the WordPress admin on edit.php.
3 *
4 * @param int $hook Hook suffix for the current admin page.
5 */
6function wpdocs_selectively_enqueue_admin_script( $hook ) {
7    if ( 'edit.php' != $hook ) {
8        return;
9    }
10    wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'myscript.js', array(), '1.0' );
11}
12add_action( 'admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script' );
13