B
B
Bodrosh2020-11-27 09:56:06
memcached
Bodrosh, 2020-11-27 09:56:06

How to beat wordpress loading speed with multiple taxonomies?

Hello. I ran into a problem when there are a lot of taxonomies in the system (I have more than 1000 of them), the site speed dropped by ~3 seconds (they were taken from woocommerce, because in it global attributes are created by separate taxonomies pa_attr1, pa_attr_2, ... pa_attrN, and taxonomies are registered on almost every back- and front-end page, i.e. woo does in wp-content/plugins/woocommerce/includes/class-wc-post-types.php (209)

$attribute_taxonomies  = wc_get_attribute_taxonomies();
foreach ( $attribute_taxonomies as $tax ) {
          register_taxonomy( $name, apply_filters( "woocommerce_taxonomy_objects_{$name}", array( 'product' ) ), apply_filters( "woocommerce_taxonomy_args_{$name}", $taxonomy_data ) );
}

Below is an example of loading the main page of the site before and after disabling this cycle of taxonomy registrations:
5fc0a1e576b0e742863969.jpeg

How can I resolve this moment? There was an idea to cache the result of register_taxonomy for each of them in memcache, but the function returns $taxonomy_object, as I understand it, it won’t be possible to cache it like that and getting into the wp core is not the best solution? Or are there other ways to get around this? Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question