Created
January 10, 2013 20:05
-
-
Save WebEndevSnippets/4505328 to your computer and use it in GitHub Desktop.
WordPress: Automatically Create Page on Theme Activation
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
$page = get_page_by_title( 'Submissions Test' ); | |
if ( null == $page ) { | |
$args = array( | |
'post_type' => 'page', | |
'post_title' => 'Submissions Test', | |
'post_status' => 'private', | |
'post_content' => 'This page was automatically created for your theme. This page displays your Submissions entries and SHOULD NOT BE REMOVED.', | |
'comment_status' => 'closed', | |
'ping_status' => 'closed', | |
); | |
$id = wp_insert_post( $args ); | |
if ( ! is_wp_error( $id ) ) | |
update_post_meta( $id, '_wp_page_template', 'page_submissions.php' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment