Thanks!
You can do this with the
wpdc_change_post_categoryfilter. It’d be something like (untested example code, but may work out of the box):
I believe you mean wpdc_publish_post_category? wpdc_change_post_category doesn’t appear to actually exist. It’s just a custom function name that can be anything, correct?
$wp_category_name = get_the_category( $post_id )[0]->name is missing the closing ;.
After that, I get a too few arguments error concerning function wpdc_change_post_category( $category, $post_id ) {. It might be because $category is undefined? I may test more later.
Concerning adding this as an official feature, I don’t think it would be that big of a can of worms, considering two options:
- The Force Category Update option already exists. This could be extended to a feature that forces Discourse/WordPress categories to always be in sync.
or
- Maybe they don’t need to be in sync at all, but rather if a category doesn’t exist in Discourse, it simply creates it.