How to Automatically Create Pages ?
-
We can create post automatically via wp_insert_post. for example
$new_post = array(
‘post_title’ => ‘My New Post’,
‘post_content’ => ‘Lorem ipsum dolor sit amet…’,
‘post_status’ => ‘publish’,
‘post_date’ => date(‘Y-m-d H:i:s’),
‘post_author’ => $user_ID,
‘post_type’ => ‘post’,
‘post_category’ => array(0)
);
$post_id = wp_insert_post($new_post); see https://www.wprecipes.com/wordpress-tip-insert-posts-programmaticallyBut how about pages ? i believe we can change ‘post_type’ => ‘post’, to
‘post_type’ => ‘page’now, can any body help how to create pages and attach it into its respective page_template ?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to Automatically Create Pages ?’ is closed to new replies.