Taxonomy drop down not updating

This topic contains 4 reply and 3 voices, and was last updated by towhid 9 years ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
April 1, 2015 at 4:13 pm 40448
towhid I have a taxonomy dropdown with 'child of' and the dropdown is populating properly however once submitted the the post in not updated with taxonomy. I have a custom action that might be causing the issue, any suggestions? /** Hook front end post create to link questionaire style category selection to WP core categories automatically **/ function wpufe_update_post_category( $post_id ) { $slugs = get_post_meta( $post_id, 'categories_questionare', true ); $slugs = preg_split('/\| /', $slugs); $category_ids = array(); foreach ($slugs as $slug) { $idObj = get_category_by_slug($slug); $id = $idObj->term_id; array_push($category_ids, $id); } ///I think is is overwriting the categories here ///can i push the taxonomy dropdown selection into here wp_set_post_categories( $post_id, $category_ids, false ); } add_action( 'wpuf_add_post_after_insert', 'wpufe_update_post_category'); add_action( 'wpuf_edit_post_after_update', 'wpufe_update_post_category' );
April 2, 2015 at 4:22 pm 40543
Nayem Nayem

Hello,

I have to discuss with my developer about this. Please allow me some time.

Thank you 🙂

April 4, 2015 at 10:47 am 40616
towhid towhid

Hello,

I have reproduced this issue and failed. I will request you to comment out custom action and see is it working perfectly or not and let me know the result.

Thank you 🙂

April 10, 2015 at 3:09 pm 41052
Ernest Ernest

CHANGE’ false’ -> wp_set_post_categories( $post_id, $category_ids, false );
TO ‘true’ -> wp_set_post_categories( $post_id, $category_ids, true );

My hook was overwriting the taxonomy because ‘false’ means that it is updating/overwriting and ‘true’ just adds to the taxonomy.

April 11, 2015 at 4:53 pm 41109
towhid towhid

Hello Ernest,

I am glad to know that you had got a solution on your own. Hope this experience will help others if they encounter this kind of problem.

Thank you 🙂

Viewing 4 Posts - 1 through 4 (of 4 total)