Created
June 29, 2012 07:49
-
-
Save versluis/3016538 to your computer and use it in GitHub Desktop.
How to bring back Post Categories in P2 v1.4
This file contains 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
// define $post_cat | |
$post_cat = $_POST['post_format']; | |
// and turn it into the category ID | |
$post_cat = get_category_by_slug( $post_cat ); | |
$post_id = wp_insert_post( array( | |
'post_author' => $user_id, | |
'post_title' => $post_title, | |
'post_content' => $post_content, | |
'post_type' => 'post', | |
'tags_input' => $tags, | |
'post_status' => 'publish', | |
// bringing back P2 categories | |
'post_category' => array( $post_cat->cat_ID ) | |
// | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment