Custom post edit with button to save post and start creating new
I have custom post edit screen with custom metaboxes and wanted the last metabox to Save this post and start creating a new one.
It's easy to redirect user to new post creation page with url like post-new.php?post_type=customposttype but what url should I call with javascript before this to make the post saved?
Thanks
add_meta_box(addanotheritem, 'Add another', 'addanother_metabox', 'custompost', 'side', 'high');
function addanother_metabox() {
?
script type=text/javascript
function saveAndGo() {
jQuery('button.editor-post-publish-button__button').click();
window.location='./post-new.php?post_type=custompost';
return false;
}
/script
button onclick='javascript:saveAndGo();'save add another/button
?php
}