Any tips or tricks to help debug this further would be much appreciated.
Scenario:
In 1/3 server environments, the wp_list_categories() function is returning: ‘No categories’, while the remaining 2 display as expected. As it’s _production behaving badly, I’m a limited in visible debugging.
Environments:
- _dev – localhost, using most current database from _production
- _staging – same server, same database host as _production
- _production – shows no categories in list wp_list_categories()
Debug so far:
- Ensure posts are categorized, which they are, in a hierarchy
- Ensure the _prod templates and database was synced to my _dev environment
- Use strict php debug mode to remove any errors, even if they were non-breaking
- Disabled single additional plug-in added in _prod
- Admin panel categories also reflect this issue with 819 counted, and ‘No categories’ found listed.
- Looked for similar issues on StackOverflow/Search Engines
Code:
<?php
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'style' => 'list',
'show_count' => 0,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'hierarchical' => true,
'title_li' => __( '' ),
'show_option_none' => __('No categories'),
'number' => NULL,
'echo' => 1,
'depth' => 1,
'pad_counts' => 0,
'taxonomy' => 'career-location' );
wp_list_categories( $args );
?>
After much trouble-shooting, it was clear that the server hosting the database was hitting a resource wall when trying to list 800+ categories, and their children.
A malconfigured XML syntax had dumped many categories into the wrong location, bloating the DB. This was resolved by cleaning the DB, but also, the server will be upgraded to resolve future resource blocks.