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

Allow hierarchy to be created under a certain parent #10

Open
tyxla opened this issue Feb 25, 2016 · 7 comments
Open

Allow hierarchy to be created under a certain parent #10

tyxla opened this issue Feb 25, 2016 · 7 comments
Labels

Comments

@tyxla
Copy link
Owner

tyxla commented Feb 25, 2016

No description provided.

@tyxla tyxla added the feature label Feb 25, 2016
@RubenMartins
Copy link

Hi @tyxla do you have updates on this feature?

@tyxla
Copy link
Owner Author

tyxla commented Jun 26, 2017

Howdy @RubenMartins!

I don't have anything right now, unfortunately, because I've been busy with a lot of stuff recently. But this one is one of my immediate TODOs as soon as I get back to working on this project. Of course, any contributions are welcome and I'd love to help with landing this feature.

@RubenMartins
Copy link

RubenMartins commented Jun 28, 2017

I'm creating this feature and once done will create an PR.

The key changes will be:

  • Create extra select field in form for "Parent Term"
  • Hiding the Parent Term field when a non-hierarchical taxonomy is selected
  • The Parent Term be auto filled by the change of Taxonomy select field - javascript ->ajax auto-fill
  • Consider custom post type -> custom taxonomies
  • The List of terms by taxonomy by function wp_dropdown_categories() same as in wp-admin/edit-tags.php witch is faster then get_terms for long and styled list
  • Import to the selected parent
  • Tests...

Anything else you might think of edit this list please.

@RubenMartins
Copy link

I'm also facing an "issue" where I have a lot of terms hierarchically and on slow servers this might create a problem generating the list of terms like 2k+.

I'm thinking @tyxla on dynamic list by hierarchy and I think on this 2 possible ways:

  1. The list of parent be a full list with childs on the same select field ordered by parent and the alphabetically and so on (the most problematic on slow servers) but probably can be overcome by the way WordPress works on the wp-admin/edit-tags.php with big lists on the parent select.
  2. Dynamic list generated be the selected like ->select the Taxonomy->auto load an select with direct parent->on select this parent then auto load the childs of the selected on new field or on the same.

What's your feedback on this or input from users?
Any possible and better way I'm not thinking right now?

@tyxla
Copy link
Owner Author

tyxla commented Jun 30, 2017

Thanks for working on this @RubenMartins! I'm happy to provide any help you might need in the process.

Create extra select field in form for "Parent Taxonomy"

You probably mean "Parent Term", here right? Yes, that's how I'd envision it to work. Maybe we could use something from the WP core for generating the field, like wp_dropdown_categories() for example. This field should probably be hidden when a non-hierarchical taxonomy is selected though, so we'll also need to take that into consideration.

The Parent Taxonomy be auto filled by the change of Taxonomy select field - javascript ->ajax auto-fill

That makes complete sense - we probably wouldn't want to load all terms from all taxonomies on the initial admin page load.

Consider custom post type -> custom taxonomies

Not sure what you mean here, could you please elaborate?

The List of terms by taxonomy by function wp_dropdown_categories() same as in wp-admin/edit-tags.php witch is faster then get_terms for long and styled list

Agree; using core WP functions is always a good idea, because most of them are optimized and take advantage of the available caching mechanisms.

Import to the selected parent

Not sure what you mean here, too.

Tests...

Yes, please 😉 This plugin has been lacking tests from the beginning, but we should probably start with adding tests for the current functionality, and then add up tests for every new feature as we build it.

Anything else you might think of edit this list please.

I think you've done a pretty good job with outlining what needs to be done. Maybe you could add "Hiding the Parent Term field when a non-hierarchical taxonomy is selected" to the list.

@tyxla
Copy link
Owner Author

tyxla commented Jun 30, 2017

I'm also facing an "issue" where I have a lot of terms hierarchically and on slow servers this might create a problem generating the list of terms like 2k+.

Yes, that's always the case unfortunately, and there are many shared hosts that set the allowed memory too low. Or there are websites that have 50+ plugins enabled at the same time - this could also be the reason behind exhausting the available memory. We can do some things to solve that, fortunately.

The list of parent be a full list with childs on the same select field ordered by parent and the alphabetically and so on (the most problematic on slow servers) but probably can be overcome by the way WordPress works on the wp-admin/edit-tags.php with big lists on the parent select.

I don't think I've seen the WP core break with term hierarchy retrieval with thousands of terms. Maybe we could use what core's using for the term selector field?

Dynamic list generated be the selected like ->select the Taxonomy->auto load an select with direct parent->on select this parent then auto load the childs of the selected on new field or on the same.

That could probably be confusing for some users though. I'd probably consider a more user-friendly interface to be the one like the "tags" in a post, where it autocompletes user's input. So we have a search field, and when the user inputs 2 or more characters, it makes a search and displays only the terms that match that search. That solution makes sense to me, because if you want to create a term hierarchy under a certain parent taxonomy term, you'll definitely know that term parent's name, right?

Hope that helps, and again, thanks for working on this one 👍

@RubenMartins
Copy link

Thanks for the feedback, I have updated the list of TODO with your input and will further proceed.
The checked items are the ones I have already finished. The remaining items will keep the development and I'll inform you once completed.

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

No branches or pull requests

2 participants