Last active
December 14, 2015 11:58
-
-
Save versluis/5082881 to your computer and use it in GitHub Desktop.
This code adds category posting back into P2
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 ) | |
// end of mod | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment