ylefebvre / link-library

Link Library WordPress Plugin source code. Main plugin available from wordpress.org site
https://wordpress.org/plugins/link-library/
GNU General Public License v2.0
6 stars 2 forks source link

Child categories are displayed twice #17

Open Digihulpdienst opened 1 year ago

Digihulpdienst commented 1 year ago

Hi,

On https://www.natams.nl/links-with-error/ the child categories get displayed twice in the category list. I use the shortcode [link-library-cats settings="1"] to display a selection of categories and child categories.

I can't find a setting to prevent the 19 child categories being displayed again.

Attached the settings.

What can I do? Thanks for your help.

SettingSet1Export.csv

(I updated this message because I copied the bad page to a new URL (as you can see now above). I try to find a work around on the main page www.natams.nl/links )

slabbi commented 1 year ago

Can confirm this. When using nested categories the sub categories are added in the root again.

slabbi commented 1 year ago

Has also been reported @wordpress: https://wordpress.org/support/topic/duplicate-flattened-categories-using-link-library-cats/

khatchad commented 1 year ago

More info here: https://redmine.gc.cuny.edu/issues/17267

slabbi commented 1 year ago

Still broken in 7.4.1

ylefebvre commented 1 year ago

Looking at the configuration file provided, I see that around 30 categories were selected to be displayed by that person’s instance of Link Library. Unless all of the selected categories are all at the same hierarchical level, then this will lead to duplicate categories to be displayed.

When you render a list of link categories, or a list of links, the plugin goes through the list of selected categories and consider them to be top-level categories, then if these categories have children, it goes through these children. Plain and simple.

slabbi commented 1 year ago

Well, it worked with hierarchical categories quite fine (I think it broke in 7.3.x). We can do a video meeting so you can check the configuration if you like.

khatchad commented 1 year ago

Well, it worked with hierarchical categories quite fine (I think it broke in 7.3.x). We can do a video meeting so you can check the configuration if you like.

I also experienced this. No problems with hierarchical categories in the past.

slabbi commented 1 year ago

Hierarchical categories broke in 7.3.16. In 7.3.15 hierarchical categories works fine.

Replacing the file render-link-library-cats-sc.php with the file from 7.3.15 fixes the problem.

ylefebvre commented 1 year ago

Thanks @slabbi for identifying when the problem was introduced. The issue is now corrected in version 7.4.7. @khatchad and @Digihulpdienst, please try the new version and confirm if this also resolves your issue.