• 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 Reply Cancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular

  • I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification
  • Testing Event Listeners In Jest (Without Using A Library)
  • Thoughts on the Flipper Zero
  • How To Get The Hash of A File In Node.js
  • Waiting for an Element to Exist With JavaScript
  • How To Paginate An Array In Javascript
  • Handling Errors with the Fetch API
  • How To Get Last 4 Digits of A Credit Card Number in Javascript
  • Wild Natural Deodorant Review
  • How To Install Eufy Security Cameras Without Drilling or Using Screws

Recent Comments

  • CJ on Microsoft Modern Wireless Headset Review
  • Dwayne on Microsoft Modern Wireless Headset Review
  • CJ on Microsoft Modern Wireless Headset Review
  • john on Microsoft Modern Wireless Headset Review
  • Dwayne on Why You Should Be Using globalThis Instead of Window In Your Javascript Code

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz