您只需将必要的javascript放入一个文件中,并将其排入必要的页面即可:
add_action( \'admin_enqueue_scripts\', \'add_admin_scripts\', 10, 1 );
function add_admin_scripts( $hook ) {
//You can globalise $post here and enqueue the script for only certain post-types.
if ( $hook == \'post-new.php\' || $hook == \'post.php\') {
wp_register_script( \'my_js_handle\',\'/path/to/js/my-js-file.js\',array(\'jquery\'),1,true);
wp_enqueue_script(\'my_js_handle\');
}
}
javascript文件包含:
jQuery(document).ready(function() {
jQuery(\'.postbox h3, .postbox .handlediv\').unbind(\'click.postboxes\');
});
(事实上,您可能只需在管理页脚中“打印”它)。