Home Forums Plugin Support WP User Frontend Pro Taxonomy drop down not updating

This topic is: resolved

This topic contains 4 replies, has 3 voices, and was last updated by  towhid 3 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #40448

    Ernest
    Member
    Post count: 10

    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' );

    #40543

    Nayem
    Moderator
    Post count: 6480

    Hello,

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

    Thank you ๐Ÿ™‚

    #40616

    towhid
    Participant
    Post count: 4505

    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 ๐Ÿ™‚

    #41052

    Ernest
    Member
    Post count: 10

    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.

    #41109

    towhid
    Participant
    Post count: 4505

    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 5 posts - 1 through 5 (of 5 total)

The topic ‘Taxonomy drop down not updating’ is closed to new replies.