Open Carlitos-Wayoff opened 7 years ago
Looking over the code, it is only going to do a wp_insert_category() call if it's not a parent, based on the continue
https://github.com/WebDevStudios/WDS-Multisite-Aggregate/blob/master/wds-multisite-aggregate.php#L366-L369
Then, later on, it assigns all the found categories to the post in question: https://github.com/WebDevStudios/WDS-Multisite-Aggregate/blob/master/wds-multisite-aggregate.php#L414
I'd be curious to see what all is ending up in $category_ids
for your case.
We're currently running this plugin in a test environment, almost identical to our live environment, let me know what you'd like me to do. Can we turn on debugging to a file or something? I can also test the parent theory since we've only had the child category cause this issue. The test environment is live as well let me know if you'd like access.
Thanks,
Carlos
no special debugging features that I'm aware of, or can see in the code. Closest I can imagine would jus be SCRIPT_DEBUG which would tell the plugin whether or not to use minified versions of any css/js files.
First off thank you for this plugin. What a nice update to the original. We've been doing some testing and found that child categories get duplicated but parents do not. All posts tested have only one category chosen. We have a sports website so for instance MLB would be the parent and Chicago Cubs would be the child. When content gets aggregated to the main blog any posts that have the parent category, MLB, import without any duplication issues. If we import posts with the child category, Chicago Cubs, the category gets duplicated. Strange as well each subsequent post with the child category continues to duplicate the category. If we have 10 Chicago Cub stories we'll end up with 10 categories and none of them have parents. I've reviewed the code and I see a section regarding category parent line 363
if ( $term && 0 == $term->parent ) { $category_ids[] = $term->term_id; continue; }
but it looks as if the category has no parent then skip the category insert. I am assuming if the category has a parent then the plugin creates that category. Is there a way to test the parent category and the child category and if they exist then do not create the category?