Support » Fixing WordPress » Post gets published instead of pending

  • I’ve recently encountered a problem with the new WordPress 2.3. While this problem only occurs when using a plugin like Role Manager to change roles and capabilities, it’s in fact a bug on the WordPress side.

    It’s quite easy to reproduce, so here’s what I’ve done. On the blog we have a lot of authors. All those authors have the same role with the same capabilities: they MAY NOT publish posts directly (capability: publish_posts), but they MAY edit their own posts afterwards (capability: edit_published_posts). This last one seems to be causing the problem, here’s what happends:

    When an author is writing a new post, and the post is saved (auto-save or manually) BEFORE pushing the “Submit for Review” button, the post is published directly, without getting the pending status. This only happens when the post is saved before submitting it.

    At first I thought it was a bug in the Role Manager plugin we were using, but when I disable “edit_published_posts” this problem disappears and posts get the pending status even when it’s saved.

    I think I fixed it now by hacking /wp-admin/includes/post.php right below line 71.

    // START fix
    if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' )) {
    	$_POST['post_status'] = 'pending';
    // END fix

    But I really don’t like hacking. 😀 So can anyone besides me confirm that this is in fact a WordPress bug?

Viewing 3 replies - 1 through 3 (of 3 total)
  • fzilbermann


    Hello Simon,

    Just encountered exactly the same issue with the pending status, and we have Role Manager plugin installed as well. Before reading your post I came to the same conclusions : if post is saved before submitting, it’s published, and with our multi-author blog, it’s quite annoying.

    I’m gonna test your hack and report, anyway thank you. If you have anything new on the subject (since this post is 3 months old :-D), feel free to inform me / us as well if you can.



    I can also confirm that this bug happens in WordPress 2.3.3 with Role Manager 2.2.1

    Moderator Samuel Wood (Otto)

    (@otto42) Admin

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post gets published instead of pending’ is closed to new replies.