I’m trying to unbind the click handler on post metaboxes so they no longer hide when the handle is clicked. I need to do this because I use the handle to contain <select>
elements & when changing these the click
event is fired.
The code that binds the click handler is here: https://github.com/WordPress/WordPress/blob/master/wp-admin/js/postbox.dev.js#L8
Unfortunately the only way to unbind it seems to be editing this file & inserting the unbind inside add_postbox_toggles
Hope anyone can help
You can just put the necessary javascript in a file and enqueue it on the necessary page:
With the javascript file containing:
(In, fact you could probably just ‘print’ it in the admin-footer).
I will share my code and I hope someone reviews it since I’m not expert in event handling.
This goes inside your plugin or your theme functions.php: