Please show us your actual code, and don’t just describe what you implemented. In this particular case, it is vital to see how you tried to implement two occurrences of the code.
Anyway, from what I understand, the following function should do what you’ve asked for:
add_action('wp_trash_post', 'wpse_136052_do_not_delete');
function wpse_136052_do_not_delete($id) {
if (in_array(get_post($id), array(
get_page_by_title('About'),
get_page_by_title('Other Page'),
get_page_by_title('Third Page'),
)))
die('You are not allowed to delete this page');
} // function wpse_136052_do_not_delete
Related Posts:
- Create a “Dummy” parent page for a hierarchy in page listing?
- Restrict admin access to certain pages for certain users
- Restrict acceess of a page in backend
- Hide page visual editor if template is selected – redux
- Increment Page Order As Pages Are Created
- Only allow new subpages to be created
- Add custom admin menu item for pages using a certain template
- Too many pages causes WordPress admin to be unusable
- Hide Visibility Option From WordPress Publish Metabox
- Backend option to include a javascript file on specific pages?
- How to make certain page templates visible to admin only
- WordPress Admin – Add Edit link to specific page under Pages Menu
- Removing the TinyMCE editor for a given page template
- Dash after page title
- Disable ADD PDF media button on rich text editor
- How to disable delete option for a specific page? [closed]
- Need to create a custom page on a website
- How to exclude authors from get_pages()
- Order by modified date working in POSTS but not PAGES
- Publish page by invoking submit via jQuery
- Translate dashboard metabox
- Custom user tables not working after migration
- Page and admin doesnt load – i tried everything
- Pages in wp-admin is not found 404
- How do I locate a third party page represented as a slug in my WordPress website?
- Customise the_title in admin area
- Creating content using wp-admin pages
- Group Pages based on Parent in Admin Area
- How to align bold,italic and underline in wp-admin?
- How to disable posts and use pages only
- Get next/previous cousin page
- I want only my sub-pages to be clickable in the navbar
- How restrict page for users logged? [closed]
- How do I turn comments off for pages, but not posts?
- List Child Pages of Parent Parent Page (Child pages from Grand Parent)
- How to add meta boxes to Pages
- Form action redirect to the same page
- How do I create a separate page for each author?
- Overriding the currently selected menu item
- Missing parent page attribute
- Is there a way to create a URL (new WP page) that can only be accessed from a specific source?
- Job Manager plugin help?
- htaccess modify headers IF url ends with “news”
- How to change only the home page / front page url on wordpress
- Give access to a simple .html file to users that bought a specific ‘digital product’
- How to make tag post listing page working?
- Admin pages, edit notes of the title of posts and pages
- Can’t get done anything with admin.php response
- Role – edit page but not publish
- Unique page URL redirect to file_get_contents() at domain
- Cannot add a class to h2 tag
- Redirect page to default subpage
- WordPress pages creation work distribution & then combining – Localhost XAMPP
- How can I check user capability when a page loads (via functions.php)?
- Add a static page that links to homepage
- How to have a next page for post?
- Can I change the “Home” text in the menu?
- Search child pages from a specific page parent
- How do you search for a post or page with a certain url on the WordPress admin panel?
- Remove_filter (‘the_content’, ‘wpautop’) only pages
- Weebly Migration to WordPress [closed]
- How To Render Shortcode In AJAX Response?
- How to create different template designs for different pages in WordPress [closed]
- Do I have to widgetize my pages?
- Page templates in subdirectories and auto generator
- Get rid of “comment” field on non-blog pages [duplicate]
- How to control display of page lists on sidebar that doesn’t have childrens
- Is there a template tag/function for getting the URL (or slug or name or ID) of the blog page when using a “static” front page
- Problems in creating a static site with WordPress
- Creating new page/tab in groups section not working! [closed]
- Change displayed “page name” to distinguish multiple pages with the same title
- add title to widgets of wordpress
- remove “Edit” from select pages
- Add custom action to the page listing screen
- How to list pages from an author?
- How can a .css file be applied to a virtual page?
- WordPress blog posts template bug [closed]
- Checkboxes to automatically create pages when I activate a theme
- Cannot update page – with too many characters?
- Is it possible to embedd this web app to my website [duplicate]
- Using external DB within wordpress
- Cannot use old slug – it just 301s to site home page
- My pages disappeared from the list
- Pre-populating new Page creation with shortcodes
- WordPress Pages “allow comments” meta option can’t be checked
- How to display time when page is created and edited
- Loading internal page
- Firing page_publish where page is child page
- Page loads all pages of the image gallery with pagination
- Google indexed pages for one page site
- static page with buton that opens collect email form
- Parent for a single (single.php)
- Create a new page for each form selection
- How to create an user defined page?
- How can one get page by pagename if it is a child page?
- Archive with specific keyword by category sorted by date
- Is it possible to keep the page title from actually appearing at the top of the page?
- Missing page on wordpress “Pages” dashboard [closed]
- I reached halfway through a WordPress tutorial to find out I began wrong for a new comer to WP
- Can’t create new pages in wordpress