Created
May 7, 2019 07:07
-
-
Save itsKnight847/21feb0207c5db697c9037070be7a4489 to your computer and use it in GitHub Desktop.
prevent users from delete specific pages
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_action('wp_trash_post', 'restrict_post_deletion', 10, 1); | |
add_action('before_delete_post', 'restrict_post_deletion', 10, 1); | |
function restrict_post_deletion($post_id) { | |
if($post_id == 2632) wp_die('This page cannot be deleted'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment