Created
October 10, 2019 08:28
-
-
Save kartick14/60cb27e809a0b64e6b2297cff0986636 to your computer and use it in GitHub Desktop.
Create a new post with custom post id and custom post name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$post = array( | |
'import_id' => 9999, | |
'comment_status' => 'open', | |
'post_content' => 'hi world!', | |
'post_name' => 'title_1', | |
'post_status' => 'publish', | |
'post_title' => 'your title', | |
'post_type' => 'post', | |
); | |
echo $post_id = wp_insert_post($post); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment