Is it possible to change the default status of every new page created to be "unpublished"?

We want to have someone help us add pages to a site, but not have them show up by default until it is (all of the pages) approved to go live.

Suggestions would be greatly appreciated.

  • 1
    users that are "contributors" can't publish – birgire Feb 8 '13 at 19:25
  • 1
    But also can't create pages without the specific capability. For posts it is as easy as changing the role of the user, for pages it is as easy as adding a capability to an existing role (see my answer below). – Sunyatasattva Feb 8 '13 at 20:10

There is a very easy solution to your problem. Just add a capability to the particular role of this user, through the Wp_Role class. Wordpress has this feature of Submitting for Review active for authors and contributor by default, but, if you want to use pages, you have to give them the edit_pages capability, but not the publish_pages one, so that they can Add new pages without being able to Publish them. This will activate the Submit for review button instead of the Publish one.

Think of something like this:

function my_authors_can_help_with_pages() {

    $user_role = get_role( 'author' );
    $user_role->add_cap( 'edit_pages' );


Then hook somewhere, whether in a plugin or functions.php, for example:

add_action('init', 'my_authors_can_help_with_pages');

Ideally, use an hook that is run the least amount of times, like after_setup_theme if its in your theme. Once you add the capability you don't need to add it multiple times: it doesn't do much bad, not it is a real performance issue, I guess it is more of an issue of elegance.

  • I am not familiar with writing code for Wordpress modules or functions. Where would I do this to say the default template? – J. Chin Feb 9 '13 at 0:47
  • Open the functions.php in your theme directory; paste the code I gave you in the bottom of that file. Nothing more on the code side. Then you have to make a new user for this person helping you (if you didn't already) and assign him/her the role "author"; all of this from the Wordpress dashboard. – Sunyatasattva Feb 9 '13 at 15:49

Something similar was posted before at https://stackoverflow.com/questions/5007748/modifying-wordpress-post-status-on-publish

This allows you to add a filter that changes the post status when you publish it. However birgire's comment about the Contributor user is probably more what you are looking for. A contributor can log in and create posts which do not get published until you log in and approve it.

add_filter('wp_insert_post_data', 'my_post_data_validator', '99');
function my_post_data_validator($data) {
  if ($data['post_type'] == 'post') {
    // If post data is invalid then
    $data['post_status'] = 'draft';
    add_filter('redirect_post_location', 'my_post_redirect_filter', '99');
  return $data;

function my_post_redirect_filter($location) {
  remove_filter('redirect_post_location', __FILTER__, '99');
  return add_query_arg('my_message', 1, $location);

add_action('admin_notices', 'my_post_admin_notices');
function my_post_admin_notices() {
  if (!isset($_GET['my_message'])) return;
  switch (absint($_GET['my_message'])) {
    case 1:
      $message = 'Invalid post data';
      $message = 'Unexpected error';
  echo '<div id="notice" class="error"><p>' . $message . '</p></div>';
  • I don't think this is what the OP wants: first of all, it is intended to work for posts and not for pages. Secondly, it is meant to be an automatic validation, while the OP wants more of a human review process as far as I understood. Also, using this code without any data validation (as in the comment in line 4) will result in an endless draft loop. – Sunyatasattva Feb 8 '13 at 20:20

When you're creating a new page, there are two buttons available in the 'publish' metabox: 'Save Draft' and 'Publish'. You can simply instruct this someone to always click on 'Save Draft' and never on 'Publish'. Later you can go in and publish all the approved pages by clicking on 'Publish'. Does this make sense?

  • Haven't downvoted, but a better solution would be to simply hide the Publish button from a specific role. And I guess it's not a good Answer because the OP doesn't asks how to "change the behavior of the user"... – brasofilo Feb 8 '13 at 20:31
  • @brasofilo I'd say unregister the meta box, but you'd anyway be able to trigger publish via query vars... – kaiser Feb 8 '13 at 20:41
  • The initial reason for me asking this question was because you can't expect people entering the text pages to always follow instructions and click "Save Draft". That is how come I want it to default to not publish the page. – J. Chin Feb 9 '13 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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