0
0
Wordpressframework~8 mins

Custom post type arguments in Wordpress - Performance & Optimization

Choose your learning style9 modes available
Performance: Custom post type arguments
MEDIUM IMPACT
This affects page load speed and rendering by controlling how WordPress registers and displays custom content types, impacting query complexity and asset loading.
Registering a custom post type with many unnecessary features enabled
Wordpress
register_post_type('book', array('public' => true, 'has_archive' => true, 'supports' => array('title', 'editor'), 'show_in_rest' => false));
Limiting supported features and disabling REST API reduces queries and asset loading, speeding up rendering.
📈 Performance GainReduces database queries and asset size, improving LCP and overall page speed.
Registering a custom post type with many unnecessary features enabled
Wordpress
register_post_type('book', array('public' => true, 'has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'revisions', 'author', 'excerpt', 'custom-fields'), 'show_in_rest' => true));
Enabling many features increases database queries and asset loading, slowing page load and rendering.
📉 Performance CostIncreases query complexity and asset size, blocking rendering longer and increasing LCP.
Performance Comparison
PatternQuery ComplexityAsset LoadRendering ImpactVerdict
Many supports enabledHigh - multiple joins and meta queriesHigh - loads extra scripts/stylesSlower LCP due to heavy queries and assets[X] Bad
Minimal supports and no extra taxonomiesLow - simple queriesLow - fewer scripts/stylesFaster LCP with leaner page load[OK] Good
Rendering Pipeline
Custom post type arguments influence how WordPress queries and prepares content, affecting server response time and the browser's ability to render the page quickly.
Server Query
HTML Generation
Network Transfer
Browser Rendering
⚠️ BottleneckServer Query stage due to complex or heavy queries from excessive features
Core Web Vital Affected
LCP
This affects page load speed and rendering by controlling how WordPress registers and displays custom content types, impacting query complexity and asset loading.
Optimization Tips
1Limit 'supports' to only needed features to reduce database queries.
2Disable 'show_in_rest' if REST API access is not required to reduce asset loading.
3Avoid registering unnecessary taxonomies to keep queries simple and fast.
Performance Quiz - 3 Questions
Test your performance knowledge
Which custom post type argument setting can increase page load time the most?
AEnabling many supports like comments, revisions, and custom fields
BSetting 'public' to false
CDisabling 'has_archive'
DNot registering the post type
DevTools: Network
How to check: Open DevTools, go to Network tab, reload page, filter by XHR and document requests to see query response times and asset sizes.
What to look for: Look for long server response times or large asset files indicating heavy queries or unnecessary scripts/styles.