Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to handle custom taxonomy archive when no posts will have that taxonomy

I decided to do what I suggested at the end of the post:

  • public => false in the taxonomy settings
  • Add add_rewrite_tag/add_rewrite_rule to ‘unit_num’
    and add a pre_get_posts action to tweak the query when get_query_parm('unit_num') is set.

This is all working well now.
(Often when you write a problem out on a forum it triggers a new outlook on the issue)

Related Posts:

  1. Can’t get a custom template taxonomy page to display
  2. WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
  3. Custom taxonomy listing page when no term set (all terms)
  4. Removing taxonomy base using WP rewrite
  5. Custom taxonomy on permalink
  6. How to enable hierarchical permalinks for hierarchical taxonomies
  7. How much faster is a tax query than a meta query?
  8. Use custom posts as taxonomy term meta replacement?
  9. Remove Custom Taxonomy Base
  10. How can I set up a category “overview” page?
  11. Nice URLs for a Custom Post Type List with a Shared Custom Taxonomy?
  12. Dynamic page slug for Custom Taxonomies?
  13. Is it possible to sort the post based on a custom field?
  14. How to fix a double slash in custom permalinks with hierarchical taxonomy’s?
  15. Getting archive pages in WP’s AJAX internal link finder?
  16. custom taxonomies on permalink
  17. Pros and cons of using [taxonomy name] in place of [category name]?
  18. List Custom Taxonomy Values according to a Post Meta Value
  19. Permalinks for quote authors
  20. Change in custom taxonomy permalink causes 404 error for another custom taxonomy
  21. Taxonomy based permalinks
  22. custom taxonomy archive permalink shows 404 error
  23. Custom taxonomy term in WooCommerce product permalink
  24. Change URL structure of subcategory archive pages
  25. Add parent/child taxonomy to custom post type url
  26. Keep taxonomy base name in post permalinks
  27. get_the_terms() to show all custom taxonomies
  28. Single reusable value for post meta: Custom Taxonomy or Post Meta?
  29. Change permalink of post if it belongs to custom taxonomy
  30. Permalinks for custom taxonomy stopped to work
  31. Date archive permalinks for custom taxonomy
  32. Custom permalinks with hierarchical taxonomy – getting PHP warning
  33. What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
  34. Is it possible to store Json data in post_meta and manipulate
  35. Add Custom Taxonomy for Blog Meta Info
  36. How to separate posts in loop?
  37. How do I modify taxonomy term slugs dynamically?
  38. Permalink help with default Posts and custom Taxonomy
  39. how to change permalinks format for pagination?
  40. Replace taxonomy permalinks
  41. Creating terms vs custom post meta to save data?
  42. How do I create a permalink structure with 2 taxonomies
  43. Base permalink for custom taxonomy
  44. Rewrite Rules returning wrong data
  45. Does using custom taxonomy is more CPU efficient than using meta_data?
  46. How to change url for taxonomy pages?
  47. Query custom taxonomy by term id?
  48. How to customize custom taxonomy url?
  49. wp_query not resetting, last post hanging
  50. Duplicate slug/permalink issue
  51. How to add hierarchical taxonomy with parent child relation to URL?
  52. WordPress modify Settings > Permalinks (options-permalink.php) Add CPT Permalink Options
  53. Count of posts by different parameters?
  54. How can I add a custom permalink to a term?
  55. Permalinks with custom taxonomies and regular categories
  56. WooCommerce custom taxonomy as meta?
  57. Need equivalent of single_term_slug
  58. 404 Error on Custom Post Type / Custom Taxonomy
  59. How to define %category% for custom taxonomies?
  60. Custom Permalink Structure for terms/taxonomies of custom post type
  61. Sort taxonomy page alphabetically by meta rather than default post date
  62. How Can I Remove Child Slug From Grandchild Slug When Using Duplicate Grandchild Slugs?
  63. Change the full permalink (URL) of a single post by connecting it to a specific page
  64. Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
  65. How can I rewrite the URL of my custom taxonomy to include the year?
  66. How do I get the correct URL?
  67. Convert post meta to custom taxonomy?
  68. Remove custom taxonomy slug from URL
  69. How to replace custom post type with custom taxonmy in permalinks
  70. Get taxonomy link with post type slug prefix
  71. Count tags for current post and save into custom meta field (and update it on post edit)
  72. How To Create Dynamic Permalink To Custom Taxonomy List of Current Posts?
  73. Restructuring permalink with more than one taxonomies
  74. Is it possible to sort the post based on a custom field?
  75. Custom taxonomy return 404
  76. Permalinks incorrectly inserting multiple categories
  77. Custom post type term names with ampersand in the term name
  78. WordPress Taxonomy Permalinks – Custom?
  79. Need help understanding a rewrite with multi-level taxonomy
  80. Looking for suggestions on creating simple database (Help!!)
  81. Broken paths on taxonomies after changing permalink to post name
  82. Custom taxonomy rewrite in permalinks for posts gives 404 on pages
  83. Permalink Rewrite to include Custom Taxonomy Term
  84. Multiple taxonomies, what should the permalink look like?
  85. get meta fields and taxonomy of any post type
  86. Where to put a migration script to switch post information?
  87. Taxonomy to WordPress Permalinks of custom post type
  88. Update fields with post object and custom tax with wp_insert_post
  89. How can I show custom field according to taxonomy?
  90. Permalinks not working on MU network with domain mapping
  91. Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
  92. Optional taxonomy in cpt permalink
  93. post_type_link not working for posts without terms
  94. Child terms with improper parent in the url should redirect to 404
  95. Using Custom Taxonomy in Default Post Slug
  96. Adding Category to Child Posts Permalink
  97. How can I list all the meta in a custom taxonomy?
  98. Custom post types, taxonomies, and permalinks
  99. How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
  100. Using wp_query is it possible to orderby taxonomy?
Categories custom-taxonomy Tags custom-taxonomy, permalinks, post-meta
Auto Generate Post Title from 2 ACF Taxonomies [closed]
How to disable display all posts from all categories?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress