
WordPress Custom Post Types: When They Break
Custom Post Types power complex WordPress sites — from portfolios to course platforms. But they can be the source of frustrating bugs.
The Dreaded 404 on CPT Pages
In Resolve Intermittent ACF 404 Errors, CPT pages were randomly returning 404s. The root cause was a permalink flush issue.
Sorting and Pagination
Fix Sorting & Pagination of Custom Post Type — the archive page showed incorrect results because the main query conflicted with a custom WP_Query.
PHP Widget Integration
In Fix PHP Widget, a custom widget displaying CPT data was crashing because it wasn’t checking for empty results.
Best Practices
- Always flush permalinks after registering CPTs
- Use
pre_get_postsfor archive modifications - Add proper
has_archiveandrewriterules - Test with the REST API to verify data structure
Need CPT help? Hire me on Upwork.


