Some WordPress plugins create a page or a post, and proper function of the plugin relies on the existence of that page or post. For example, a plugin that manages an e-mail list might rely on an unsubscribe page, which a user might delete on purpose or by accident.
How can a plugin prevent its page from being deleted?
First, when you create the page, you can store its ID in an option that you need to get later:
Then, you hook into the delete actions with functions to prevent the deletion:
In those functions, you check the id of the page being deleted and compare it to the id that you stored when you created the page.
In the “prevent trash” function, you change the status back to publish.
In the prevent deletion function, you re-create the page.
This is how I did this, and it worked for me. I would love to see how others may have approached this problem.
Stephen Jones described another interesting approach of simply hiding the pages on the wp-admen list of pages, here: hide-certain-pages-posts-on-wp-admin-show-custom-filter