Created
April 30, 2020 06:06
-
-
Save rajucs/b6213ce3c342c567b6165b58df8f9be2 to your computer and use it in GitHub Desktop.
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
if (isset($_GET['activated']) && is_admin()){ | |
$new_page_title = 'Parent Login'; | |
$new_page_content = ''; | |
$new_page_template = 'parent-login.php'; //ex. template-custom.php. Leave blank if you don't want a custom page template. | |
//don't change the code bellow, unless you know what you're doing | |
$page_check = get_page_by_title($new_page_title); | |
$new_page = array( | |
'post_type' => 'page', | |
'post_title' => $new_page_title, | |
'post_content' => $new_page_content, | |
'post_status' => 'publish', | |
'post_author' => 1, | |
); | |
if(!isset($page_check->ID)){ | |
$new_page_id = wp_insert_post($new_page); | |
if(!empty($new_page_template)){ | |
update_post_meta($new_page_id, '_wp_page_template', $new_page_template); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment