jeudi 26 mars 2015

php create wordpress post programmatically


i want to create video gallery plugin i am using this code to create post by code using php



global $user_ID;
$new_post = array(
'post_title' => 'chapter1',
'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);


its working well but problem is, created post is showing in admin dashboard "All post" panel. i don't want to show programmatically created post there. or in a latest post. is there any way i can do this . i tried to change post type but after that genrated post link give me page not found error.





Aucun commentaire:

Enregistrer un commentaire