Last active
June 26, 2021 23:43
-
-
Save cagriuckan/02313dc5d4cb39b69f612dc70a421279 to your computer and use it in GitHub Desktop.
wordpress automatic page creation
This file contains 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('after_setup_theme', 'uckan_create_pages'); | |
function uckan_create_pages(){ | |
$awesome_page_id = get_option("awesome_page_id"); | |
if (!$awesome_page_id) { | |
$post1 = array( | |
'post_title' => "Sayfa Adınız!", | |
'post_content' => "", | |
'post_status' => "publish", | |
'post_type' => 'page', | |
); | |
$postID = wp_insert_post($post1, $error); | |
update_post_meta($postID, "_wp_page_template", "template-giris.php"); | |
update_option("awesome_page_id", $postID); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment