Last active
March 21, 2017 20:02
-
-
Save marcosnakamine/6ccd437d055f3a7ef3509994ba7706ec to your computer and use it in GitHub Desktop.
WordPress - Insert new post
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
<?php | |
$post_id = wp_insert_post( array( | |
'post_content' => 'Content', | |
'post_title' => 'Title', | |
'post_type' => 'custom_post_type', | |
'tax_input' => array( 'taxonomy_post_type' ) | |
) ); | |
wp_set_object_terms( $post_id, 'custom_taxonomy', 'taxonomy_post_type', true ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment