Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate Child Categories #17

Open
Carlitos-Wayoff opened this issue Aug 9, 2017 · 3 comments
Open

Duplicate Child Categories #17

Carlitos-Wayoff opened this issue Aug 9, 2017 · 3 comments

Comments

@Carlitos-Wayoff
Copy link

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?

@tw2113
Copy link
Member

tw2113 commented Aug 9, 2017

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.

@Carlitos-Wayoff
Copy link
Author

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

@tw2113
Copy link
Member

tw2113 commented Aug 10, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants