Skip to content

Instantly share code, notes, and snippets.

@Asikur22
Last active May 19, 2019 18:30
Show Gist options
  • Select an option

  • Save Asikur22/3e1cd561b4aa97d4c2ace24a988e438e to your computer and use it in GitHub Desktop.

Select an option

Save Asikur22/3e1cd561b4aa97d4c2ace24a988e438e to your computer and use it in GitHub Desktop.
Enqueue Scripts/Styles on the post-new.php and post.php pages in admin #SpecificPage
add_action( 'admin_print_scripts-post-new.php', 'your_prefix_enqueue_scripts' );
add_action( 'admin_print_scripts-post.php', 'your_prefix_enqueue_scripts' );
// OR
function enqueue_my_scripts() {
global $pagenow;
if ( ! empty( $pagenow ) && ( 'post-new.php' === $pagenow || 'post.php' === $pagenow ) ) {
wp_enqueue_script();
}
}
add_action( 'admin_enqueue_scripts', 'enqueue_my_scripts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment