0
0
Wordpressframework~20 mins

Custom post type arguments in Wordpress - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Custom Post Type Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What is the effect of 'public' => false in a custom post type?
Consider this custom post type registration snippet:
register_post_type( 'book', array( 'public' => false, 'show_ui' => true ) );

What will be the visible behavior in the WordPress admin dashboard?
Wordpress
register_post_type( 'book', array( 'public' => false, 'show_ui' => true ) );
AThe post type is hidden both in admin UI and front-end.
BThe post type is visible on the front-end but hidden in admin UI.
CThe post type is visible both in admin UI and front-end.
DThe post type is visible in admin UI but not accessible on the front-end.
Attempts:
2 left
💡 Hint
Think about what 'public' controls versus 'show_ui'.
📝 Syntax
intermediate
2:00remaining
Which argument correctly enables REST API support for a custom post type?
You want your custom post type to be accessible via the WordPress REST API. Which argument must be set to true in register_post_type?
Wordpress
register_post_type( 'movie', array( /* arguments here */ ) );
A'show_in_rest' => true
B'rest_support' => true
C'enable_rest' => true
D'rest_api' => true
Attempts:
2 left
💡 Hint
Look for the exact argument name used in WordPress documentation.
state_output
advanced
2:00remaining
What is the slug used in URLs for this custom post type?
Given this registration code:
register_post_type( 'album', array( 'rewrite' => array( 'slug' => 'music' ), 'public' => true ) );

What will be the base URL slug for single 'album' posts?
Wordpress
register_post_type( 'album', array( 'rewrite' => array( 'slug' => 'music' ), 'public' => true ) );
A/music/{post-name}/
B/album/{post-name}/
C/albums/{post-name}/
D/post/{post-name}/
Attempts:
2 left
💡 Hint
The 'rewrite' argument controls the URL slug.
🔧 Debug
advanced
2:00remaining
Why does this custom post type not appear in the admin menu?
This code registers a custom post type but it does not show in the WordPress admin menu:
register_post_type( 'event', array( 'public' => true, 'show_ui' => false ) );

What is the cause?
Wordpress
register_post_type( 'event', array( 'public' => true, 'show_ui' => false ) );
A'show_in_menu' must be true to appear in admin menu.
B'show_ui' is false, so admin menu is hidden.
CMissing 'menu_position' argument causes it to be hidden.
D'public' must be false to show in admin menu.
Attempts:
2 left
💡 Hint
Check the meaning of 'show_ui' argument.
🧠 Conceptual
expert
3:00remaining
Which argument controls whether a custom post type supports hierarchical parent-child relationships?
You want your custom post type to behave like pages, allowing parent and child posts. Which argument enables this?
A'supports' => ['parent']
B'parentable' => true
C'hierarchical' => true
D'nested' => true
Attempts:
2 left
💡 Hint
Think about the argument that controls post relationships.