Вы можете поместить его в плагин, который вы просто загружаете, активируете и удаляете.
Вот что я использую, модифицированный для вашего использования (еще не проверял):
<?php
/*
Plugin Name: Startup Settings
Plugin URI: http://someurl/
Description: Some description
Version: 1
Author: Your Name
Author URI: http://yoursite.com
*/
function startup_settings()
{
// Remove "Hello world" post and comment.
wp_delete_post(1, TRUE);
wp_delete_comment(1);
// Insert your pages.
global $user_ID;
$about_page = array(
'post_title' => 'About us',
'post_content' => 'Your content goes here',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'page',
'post_category' => array(0)
);
$post_id = wp_insert_post($about_page);
$contact_page = array(
'post_title' => 'Contact us',
'post_content' => 'Your content goes here',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'page',
'post_category' => array(0)
);
$post_id = wp_insert_post($contact_page);
// if you want to load the privacy text from a external file (untested)
$myFile = "/path/to/privacy.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
$privacy_page = array(
'post_title' => 'Privacy',
'post_content' => $theData,
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'page',
'post_category' => array(0)
);
$post_id = wp_insert_post($privacy_page);
// Set some deafault options if you want.
$options = array(
'comment_max_links' => 0,
'comments_per_page' => 0,
'date_format' => 'd.m.Y',
'default_ping_status' => 'closed',
'links_updated_date_format' => 'l, F j, Y',
'permalink_structure' => '/%postname%/',
'rss_language' => 'en',
'use_smilies' => 0
);
foreach ( $options as $option => $value )
{
update_option($option, $value);
}
return;
}
register_activation_hook(__FILE__, 'startup_settings');
?>