Last active
December 13, 2015 03:08
-
-
Save garvs/bf49e4abb3d63c93cc74 to your computer and use it in GitHub Desktop.
Restrict the list of parent pages at WordPress page editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Post with a short description:
https://www.role-editor.com/restrict-the-list-of-parent-pages/