• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

Fixing a slow WordPress installation with thousands of hierarchical taxonomy values

Wordpress · August 6, 2021

Recently while working on a large-scale WordPress site, I encountered a tricky situation. I had quite a lot of locality data for Australian states, suburbs and LGA’s (Local Government Areas). We are talking about tens of thousands of items in the database.

At first, I made all of these custom taxonomies hierarchical. Part of the reasoning was that users could visually select values from the meta boxes (hierarchical taxonomies look better). Initially, it wasn’t a problem, but as more data was added, saving posts took forever, I was getting timeouts, and queries were slow.

If you are reading in hopes of a solution that allows you to keep using hierarchical taxonomies with tens of thousands of items, I am sorry to disappoint you.

The solution was to make all of my large taxonomies non-hierarchial. Literally setting the argument for the taxonomy to false. "hierarchical" => false,

I leveraged the Advanced Custom Fields plugin to create the taxonomy hierarchy using post relationships for those uses where I need a hierarchy. It’s not an ideal situation, but it works.

Sadly, WordPress has had this issue for several years now, and because of the way taxonomies work, I don’t think it will be fixed any time soon.

TL;DR — hierarchical taxonomies will not work properly for thousands of items. Use non-hierarchical taxonomies instead.

Dwayne

Leave a ReplyCancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular

  • Handling Errors with the Fetch API
  • How To Get The Hash of A File In Node.js
  • Thoughts on the Flipper Zero
  • How To Paginate An Array In Javascript
  • Testing Event Listeners In Jest (Without Using A Library)

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz