0

For a WP install we created a custom taxonomy which is used within a custom post type. This all seemed to work fine.

The problem started since this custom taxonomy needs to be filled with approximately 20000 areas (hierarchical). We imported them succesfully but now the custom taxonomy overview page and the custom post type edit page, which uses the custom taxonomy as category are both extermely slow (14 sec to load).

This probably has something to do with the loading of these amounts of categories. When the custom taxonomy category is empty or loaded with for example 10 categories the issue is gone.

When using the plugin Query monitor the total query time is 0,089 sec. So the problem doesn't seem to have something to do with the query times.

We are not sure where to start when debugging this so first of all 2 questions:

  • is there a known maximum of categories to be used?
  • What could be causing this huge slowdown in page loading if the problem isn't the query itself?
3
  • A form with all categories are loaded in edit post screen. Mabye the query is not too slow but the rendering of the form is. Not sure.
    – cybmeta
    Commented Dec 27, 2014 at 20:11
  • That's probably the case, as i mentioned the query time is 0.089 sec so fast enough. I was assuming the problem lies in the page rendering but not sure how to debug this correctly. Where should i start with this? Was hoping this was a known issue. Is there a way to avoid the edit post page to load all categories but create somekind of ajax auto complete search?
    – sc11423
    Commented Dec 28, 2014 at 13:39
  • The built-in select box for non-hierarchical taxonomies works like you want (like tags do). In the other hand, the select box for hierarchical taxonomies works like categories. I think this is good because it allows to see the hierarchy relationship. You can remove the taxonomy box completely and write you own meta box exactly as you want, but I think is not easy enough to be written in a simple answer. At least not for me. Other solution is described here, I don't like it, but you can try.
    – cybmeta
    Commented Dec 28, 2014 at 17:03

1 Answer 1

1

I was able to make a 'quick' fix for this issue.

The taxonomy we used is hierarchical, this was causing the edit tags and edit posts page to be very slow. Since it was a custom taxonomy where users are not allowed to edit the taxonomies or add new ones we decided to import the hierarchical taxonomy and once in the system register it as a non-hierarchical taxonomy.

This way the original hierarchy is kept in the database and can be used this way on front-end custom functions.

The non-hierarchical setting made the speed on edit pages acceptable. Another pre for the non-hierarchical setting is that the autocomplete function works a lot better for such large taxonomies.

So not the most beautiful fix, but it works for us. Still open for better solutions!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.