Last active
December 4, 2019 12:38
-
-
Save hagronnestad/5195336 to your computer and use it in GitHub Desktop.
WordPress: Hide some pages from admin to disable editing
This file contains hidden or 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
| add_filter( 'parse_query', 'exclude_pages_from_admin' ); | |
| function exclude_pages_from_admin($query) { | |
| global $pagenow, $post_type; | |
| if (is_admin() && $pagenow=='edit.php' && $post_type =='page') { | |
| $query->query_vars['post__not_in'] = array(2, 71); | |
| } | |
| } |
Author
It might still work, but I'm just chiming in to tell you that this snippet is very old by now. π
https://www.isitwp.com/exclude-pages-from-edit-list-by-id/ another source that accomplish the same π
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome stuff! Will test this out soon since this is something what i needed π