From: Steve Sutton Date: Fri, 10 Jul 2015 17:49:44 +0000 (-0400) Subject: Add notes for importing wordpress pages X-Git-Tag: v0.0.2^2~45 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=7087983127cd122c94373f650000d80e6e33ee0c;p=WP-Plugins%2Fglm-wp-importer.git Add notes for importing wordpress pages --- diff --git a/NOTES.md b/NOTES.md index 9a658da..4f0e03c 100644 --- a/NOTES.md +++ b/NOTES.md @@ -11,6 +11,40 @@ I'm planning on using the same thing here. 3. Fetch list of all images, files and import them into Media Library 4. Update all pages with new references of the images. -REFERENCES: +##REFERENCES: For Wordpress Plugin Development https://developer.wordpress.org/plugins/the-basics/header-requirements/ + +##Importing pages +https://codex.wordpress.org/Function_Reference/wp_insert_post +``` +IMPORTANT: Setting a value for $post['ID'] WILL NOT create a post with that ID number. Setting this value will cause the function to update the post with that ID number with the other values specified in $post. In short, to insert a new post, $post['ID'] must be blank or not set at all. + +The contents of the post array can depend on how much (or little) you want to trust the defaults. Here is a list with a short description of all the keys you can set for a post: + +$post = array( + 'ID' => [ ] // Are you updating an existing post? + 'post_content' => [ ] // The full text of the post. + 'post_name' => [ ] // The name (slug) for your post + 'post_title' => [ ] // The title of your post. + 'post_status' => [ 'draft' | 'publish' | 'pending'| 'future' | 'private' | custom registered status ] // Default 'draft'. + 'post_type' => [ 'post' | 'page' | 'link' | 'nav_menu_item' | custom post type ] // Default 'post'. + 'post_author' => [ ] // The user ID number of the author. Default is the current user ID. + 'ping_status' => [ 'closed' | 'open' ] // Pingbacks or trackbacks allowed. Default is the option 'default_ping_status'. + 'post_parent' => [ ] // Sets the parent of the new post, if any. Default 0. + 'menu_order' => [ ] // If new post is a page, sets the order in which it should appear in supported menus. Default 0. + 'to_ping' => // Space or carriage return-separated list of URLs to ping. Default empty string. + 'pinged' => // Space or carriage return-separated list of URLs that have been pinged. Default empty string. + 'post_password' => [ ] // Password for post, if any. Default empty string. + 'guid' => // Skip this and let Wordpress handle it, usually. + 'post_content_filtered' => // Skip this and let Wordpress handle it, usually. + 'post_excerpt' => [ ] // For all your post excerpt needs. + 'post_date' => [ Y-m-d H:i:s ] // The time post was made. + 'post_date_gmt' => [ Y-m-d H:i:s ] // The time post was made, in GMT. + 'comment_status' => [ 'closed' | 'open' ] // Default is the option 'default_comment_status', or 'closed'. + 'post_category' => [ array(, ...) ] // Default empty. + 'tags_input' => [ ', , ...' | array ] // Default empty. + 'tax_input' => [ array( => , => ) ] // For custom taxonomies. Default empty. + 'page_template' => [ ] // Requires name of template file, eg template.php. Default empty. +); +```