문제

I'm trying to add a "Publish" link by the quick actions:

enter image description here

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.

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top