尝试以下操作:
<div class="my-metabox">
<!-- This is your metabox HTML -->
<-- Add this button somewhere: -->
<button id="my-submit" class="button button-primary button-large">Submit</button>
</div>
根据需要添加此JavaScript片段
only to this screen (通过检查帖子类型并将其列在管理页脚中,或直接将其与metabox HTML一起输出):
<script type="text/javascript">
jQuery(function($) {
// You can substitute this with a CSS rule somewhere:
// <style type="text/css"> #submitdiv { display: none } </style>
// if you wish to avoid the hiding \'flicker\'
$(\'#submitdiv\').hide();
$(\'#my-submit\').on(\'click\', function(ev) {
ev.preventDefault();
$(\'#publish\').trigger(\'click\');
});
});
</script>