wordpress inserting posts programatically
-
I have to write a service that will automatically add posts in wordpress.
I know the following code can help, but I am not sure how to use it. If I write in inside the functions.php file, I will have no control over it.
global $user_ID; $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);
Someone please tell me how to write a service using this code in php
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘wordpress inserting posts programatically’ is closed to new replies.