[Plugin: The Events Calendar] Fix for category deselection bug (4 posts)

  1. avocado
    Posted 6 years ago #

    I've fixed the bug where setting a post to be an even t causes it to remove categories alphabetically prior to "Events".

    The problem was line 845, where array addition was used on two arrays that were both numerically indexed. Changing that to an array_merge instead preserves all members of the array.

    Old code:

    wp_set_post_categories( $postId, array( get_category( $category_id )->cat_ID ) + $cats );

    New code:

    wp_set_post_categories( $postId, array_merge(array( get_category( $category_id )->cat_ID ), $cats ));

    I hope this fix will make it into the next version of the plugin.


  2. FreeWestchester
    Posted 6 years ago #

    Thanks. I thought I was the only one getting this. ^_^

  3. Shane Pearlman
    Modern Tribe
    Posted 6 years ago #

    Thanks for the patch,

    We'll add it in to 1.6.


    For updates, release information and tips about our open source plugins, follow us on twitter @justlikeair.

  4. andrewlarimer
    Posted 6 years ago #

    Thanks avocado! This was drivin' me nuts trying to figure out.

Topic Closed

This topic has been closed to new replies.

About this Topic