Calling Wordpress Action only when the plugin page is loaded

by Kishore on September 14, 2009

wordpress-hacks Working on the Multiple blog managing plugin, I faced a few issues with JQuery. There were some conflicts with other plugins installed. Either this plugin was having problem in working or some others plugins stopped working. I thought of calling the scripts only when this particular plugin page is loaded. Wordpress actions has an option to do this. This code explains the way it can be done.

I am not sure, if this is the right way to avoid conflicts, but its work right for my case.

There are some other methods like using the jQuery.noConflict() function to avoid conflicts in jQuery.

function kish_multi_wp_add_admin() {
    $plugin_page=add_options_page('Kish Multi WP', 'Kish Multi WP', 8, 'kish-multi-wp', 'kish_multi_wp_option');
    add_action( 'admin_head-'. $plugin_page, 'kish_multi_wp_addHeaderCode' );
    add_action( 'admin_head-'. $plugin_page, 'add_tinymce' );
    add_action( 'admin_head-'. $plugin_page, 'kish_multi_wp_style' );
}
add_action('admin_menu', 'kish_multi_wp_add_admin');

The first function add_action is called only when the plugin page is loaded. This sorted out many of my conflict issues

Possibly Interesting Posts

New Guidelines for Plugin Developers - Wordpress : Mark Jaquith has written on his blog on the Wordpress plugin repository where Plugin Authors can hos..[](0)
Adobe Plugs 13 Security Holes in Critical Update : Adobe Systems embarks on a new schedule for security updates with 13 critical fixes in tow for Reade..[](1)
Security Expert Suggests Twitter Focus on Output Escaping not Input Filtering : Twitter's status blog this morning announced that Twitter has addressed the most recent variant of..[](1)
Checklist for submitting your plugin to Wordpress Extension Directory : You will be knowing that Wordpress can host your plugin at the Wordpress Extension Directory. You c..[](57)

Leave a Comment

Previous post:

Next post: