Opened 10 years ago
Closed 8 years ago
#30352 closed defect (bug) (duplicate)
Prevent an editor to move the front page / posts page to trash
Reported by: | benoitchantre | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | Cc: |
Description
When an admin choose to use static pages for the front page and the posts page in the reading settings, an editor should not be able to unpublish them.
Attachments (1)
Change History (15)
#1
@
10 years ago
- Summary changed from Prevent an editor to move the homepage / blog page to trash to Prevent an editor to move the front page / posts page to trash
#3
@
10 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
I almost wonder if we shouldn't allow those pages to be unpublished by anybody while they're still set for those options, but certainly it seems to make sense not to allow somebody to alter that unless they have the capability to edit the setting.
#6
@
10 years ago
I have the logic ready, just unable to figure out where to add it.
Can't do it in wp-admin/edit.php.
Reviewed wp-admin/includes/class-wp-post-list-table.php and added the check and it works, but an editor can always go inside the page and trash it from there.
So, I figured the better way to stop editor from deleting a page which is being used as front page should be editing the user's capability of
delete_pages
Now unable to figure it out where to do that. Looking inside /wp-admin/includes/schema.php but I think it's not right. Looking for pointers.
#7
@
10 years ago
- Keywords has-patch added; needs-patch good-first-bug removed
I have added a function to prevent the editor user role from deleting any page which has been selected as the front page.
Awaiting review.
This ticket was mentioned in Slack in #core by mrahmadawais. View the logs.
10 years ago
This ticket was mentioned in Slack in #core by jorbin. View the logs.
9 years ago
#11
@
9 years ago
I wonder if it might be simpler to add this into the delete_post section of map_meta_cap
Related: #17470, #21665, #30190.