I don’t see a plugin for this, but I’ve done it below with JavaScript. This adds a Quick Publish button next to Quick Edit. Add it to your functions file or use the Code Snippets plugin.
<?php
add_action('admin_footer', 'wpsf_add_quick_publish', 100);
function wpsf_add_quick_publish()
{ ?>
<script>
(function($) {
// Add a Quick Publish button
var quickPublishButton = '' +
'<span class="quick-publish">' +
' <a href="javascript:;">Quick Publish</a>' +
' | ' +
'</span>';
$('.row-actions > .inline').after(quickPublishButton);
// When Quick Publish is clicked...
$('.quick-publish').click(function() {
// Open Quick Edit
$(this).closest('.row-actions').find('.editinline').click();
// Wait a moment for Quick Edit to open
setTimeout(() => {
// Select Published from the Status dropdown
$('.inline-editor select[name="_status"]').val('publish');
// Click Update
$('.inline-editor .save').click();
}, 500);
});
})(jQuery);
</script>
<?php
}
Very cool, thank you! I’ve also always seen and heard about the code snippets plugin but never tried it. I decided to try it out. It’s very nice. Sure, you can pop these things into functions.php, but this is a nice visually organized way to do it.
But, after saving this snippet I got a blank screen and the URL has code error in it. However, the code works and there no errors in the console. And so I’m hoping it’s just a bug with the code snippets plugin or a conflict with another plugin. I guess if everything works and there are no errors showing I’ll just live with it.
You got a blank screen after clicking Save Changes and Activate on the snippet edit screen? I tested it again on a clean install with just Twenty Twenty One theme and the Code Snippets plugin and it works without issue. So that does point to a theme or plugin conflict.
Happy to help! 🙏 This was a fun scripting exercise.
Thanks for the testing that really quick! Yes, it’s definitely a plugin conflict then. I’ll do the old deactivate and reactivate plugins one at a time at some point.
The code you provided works great!