WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way I can call a link so when clicked it publishes the post via the ID I provide? I have get_delete_post_link( $postID ) set fine, and would like to do the same to make a draft go to published, or if you can't publish post, make it pending. I also have this code running in my functions.php file so may be also a way to call this if a link is clicked.

share|improve this question

I used URL parameters and created a specific function called at init:

    add_action( 'init', 'publish_post_status' );
    function publish_post_status($post_id){
            if (isset($_GET['publish']) && current_user_can('publish_posts')) {
                    if ($_GET['publish'] == "true") {
                            $current_post = get_post( $_GET['post_id'], 'ARRAY_A' );
                            $current_post['post_status'] = 'publish';
            if (isset($_GET['queue'])) {
                    if ($_GET['queue'] == "true") {
                            $current_post = get_post( $_GET['post_id'], 'ARRAY_A' );
                            $current_post['post_status'] = 'pending';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.