Publish, Save Draft and Preview buttons do not work after being moved with jQuery
I’m trying to change the layout of the post-new.php page and as part of this I would like the publish, save draft and preview buttons below the form rather than to the right.
So in my plugin js file I’m using jQuery.append() to move them into a custom that sits below the main . I’m moving the divs: #save-action, #preview-action and #publishing-action.
This works fine layout-wise. However, now none of the buttons seem to perform their job. The publish button just appends some text to the url, the preview button just refreshes the page and the save draft button does nothing. I’m assuming I’ve broken something by moving them because all of my other styling works with their functionality.
Does wordpress reference the they are in or something like that to attach the actions to the buttons?
One fix would be to just call the relevant wp_*_() functions myself on the buttons but I can’t seem to find them in the codex.
I guess another fix would be to move them while maintaining the structure of s that wordpress needs to keep the functionality intact.
I’m new to plugins in the backend so I’m probably doing something very wrong. I’d be grateful if someone could point me in the right direction. Or help me find the relevant wp_*_() functions to “re-attach” to the buttons.
Thank you for your time.
Leave an answer