I'm trying to add a "Publish" link by the quick actions:
but I'm not exactly sure of how implement it.
Here's what I've got so far:
add_filter('post_row_actions', function ( $actions )
{
global $post;
// If the post hasn't been published yet
if ( get_post_status($post) != 'publish' )
{
$nonce = wp_create_nonce('quick-publish-action');
$link = get_admin_url('path to where') . "?id={$post->id}&_wpnonce=$nonce";
$actions['publish'] = "<a href=\"$link\">Publish</a>";
}
return $actions;
});
As you can see, I don't know where to link to in get_admin_url
. I think I should be using wp_publish_post()
, but I don't know where to put that code, and how to link to it.