WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. avocado
    Member
    Posted 4 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.

    Thanks!

  2. FreeWestchester
    Member
    Posted 4 years ago #

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

  3. Shane Pearlman
    Modern Tribe
    Posted 4 years ago #

    Thanks for the patch,

    We'll add it in to 1.6.

    -S

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

  4. andrewlarimer
    Member
    Posted 4 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