Skip to content

Instantly share code, notes, and snippets.

@garvs
Last active December 13, 2015 03:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garvs/bf49e4abb3d63c93cc74 to your computer and use it in GitHub Desktop.
Save garvs/bf49e4abb3d63c93cc74 to your computer and use it in GitHub Desktop.
Restrict the list of parent pages at WordPress page editor
<?php
add_filter('page_attributes_dropdown_pages_args', 'restrict_parent_pages_for_role', 10, 2);
function restrict_parent_pages_for_role($args, $post) {
if (current_user_can('editor')) {
// list of pages to include into the parent pages dropdown menu. Do not use with 'exclude' together.
$args['include'] = array(2, 763);
// list of pages to exclude from the parent pages dropdown menu. Do not use with 'include' together.
//$args['exclude'] = array(776, 870, 871, 873, 876);
}
return $args;
}
@garvs
Copy link
Author

garvs commented Dec 12, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment