Created
November 26, 2016 04:07
-
-
Save jaredatch/eb2225b17a95e78d31978df55e356960 to your computer and use it in GitHub Desktop.
WPForms
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 | |
/** | |
* WPForms automatically add category to posts created with post submission addon. | |
* | |
* @param int $post_id Post ID of the new post created | |
* @param array $fields | |
* @param array $field_data | |
* @param int $entry_id | |
*/ | |
function wpf_post_submissions_add_category( $post_id, $fields, $form_data, $entry_id ) { | |
// Auto assign the category with the ID of 6 | |
wp_set_post_categories( $post_id, array( 6 ) ); | |
} | |
add_action( 'wpforms_post_submissions_process', 'wpf_post_submissions_add_category', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment