Skip to content

Commit

Permalink
Add plugin to setup the site.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwelcher committed May 21, 2024
1 parent 64c0a13 commit 2b6ef55
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions _blueprint/setup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
/**
* Plugin Name: Setup MVC To-do demo
*/

add_action(
'init',
function () {

// Create a new page.
$page_args = [
'post_type' => 'page',
'post_status' => 'publish',
'post_title' => '',
'post_content' => '<!-- wp:to-do-mvc/to-do-mvc /-->'
];
$page = wp_insert_post( $page_args );

if ( ! is_wp_error( $page ) ) {
// Set the site to show the page on the front.
update_option( 'show_on_front', 'page' );

update_option( 'page_on_front', $page->ID );
}
}
);

0 comments on commit 2b6ef55

Please sign in to comment.