Wie erstelle ich automatische Posts in WordPress?

Ich habe eine sehr intensive datengestützte WordPress-Anwendung. Momentan erstelle ich WordPress-Posts mit einem baseshortcode-Plugin, das Daten aus der database holt und in Tabellenform anzeigt.

Ich möchte diesen process automatisieren, wo die Beiträge automatisch im Entwurfsstatus erstellt werden.

Solutions Collecting From Web of "Wie erstelle ich automatische Posts in WordPress?"

Sie können die function wp_insert_post () verwenden, um einen neuen Post zu erstellen, der sich in einem Entwurfsstatus befindet. Wie Sie in diesem Codeschnipsel sehen können, können Sie alle Aspekte des Posts steuern, einschließlich Post-Datum, Entwurfsstatus, Post-Typ, Kategorien und vieles mehr.

$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' => [ Ymd H:i:s ] // The time post was made. 'post_date_gmt' => [ Ymd 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. ); wp_insert_post($new_post);