Last active
December 25, 2015 04:59
-
-
Save kadavre/6921193 to your computer and use it in GitHub Desktop.
Never ever simply hook into 'admin_head' to add your script: not only you will be adding it to every admin pages (the Dashboard, Comments, etc…) but also to every other plugin pages. Seriously, half of the support question I've had with Who Sees Ads were because of WP-ContactForm adding its crappy javascript everywhere it could, including my plu…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mypage = add_management_page( 'myplugin', 'myplugin', 9, __FILE__, 'myplugin_admin_page' ); | |
add_action( "admin_print_scripts-$mypage", 'myplugin_admin_head' ); | |
function myplugin_admin_head() { | |
// what your plugin needs in its <head> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment