The Dynamic Post Types module allows you to register and manage custom post types from your WordPress admin, in Tools > Post Types menu.
All native post types settings can be set within the UI. ACF Extended also adds more advanced settings allowing to manage posts per page, order etc…
Post type name. Max. 20 characters, cannot contain capital letters or spaces
A short descriptive summary of the post type
Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The 'supports' parameter should contain 'page-attributes' to show the parent select box on the editor page.
An alias for calling add_post_type_support() directly. As of 3.5, boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.
An array of registered taxonomies like category or post_tag that will be used with this post type. This can be used in lieu of calling register_taxonomy_for_object_type() directly. Custom taxonomies still need to be registered with register_taxonomy()
Controls how the type is visible to authors (show_in_nav_menus, show_ui) and readers (exclude_from_search, publicly_queryable)
Whether to exclude posts with this post type from front end search results
Whether queries can be performed on the front end as part of parse_request()
Can this post type be exported
Whether to delete posts of this type when deleting a user. If true, posts of this type belonging to the user will be moved to trash when then user is deleted.
If false, posts of this type belonging to the user will not be trashed or deleted. If not set (the default), posts are trashed if the post type supports author. Otherwise posts are not trashed or deleted
Whether to generate a default UI for managing this post type in the admin
ACF Extended: Which template file to load for the archive query. More informations on Template hierarchy
Enables post type archives.
Will use post type name as archive slug by default.
ACF Extended: Number of posts to display in the archive page
ACF Extended: Sort retrieved posts by parameter in the archive page. Defaults to 'date (post_date)'.
ACF Extended: Designates the ascending or descending order of the 'orderby' parameter in the archive page. Defaults to 'DESC'.
ACF Extended: Which template file to load for the single query. More informations on Template hierarchy
Triggers the handling of rewrites for this post type. To prevent rewrites, set to false.
Use additional rewrite arguments
Customize the permalink structure slug. Defaults to the post type name value. Should be translatable.
Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true.
Should a feed permalink structure be built for this post type. Defaults to has_archive value.
Should the permalink structure provide for pagination. Defaults to true.
Additional arguments
ACF Extended: Add an "Archive" Options Page as submenu of the post type.
ACF Extended: Number of posts to display on the admin list screen.
ACF Extended: Sort retrieved posts by parameter in the admin list screen. Defaults to 'date (post_date)'.
ACF Extended: Designates the ascending or descending order of the 'orderby' parameter in the admin list screen. Defaults to 'DESC'.
An array of labels for this post type. By default, post labels are used for non-hierarchical post types and page labels for hierarchical ones.
Default: if empty, 'name' is set to value of 'label', and 'singular_name' is set to value of 'name'.
The string to use to build the read, edit, and delete capabilities.
May be passed as an array to allow for alternative plurals when using this argument as a base to construct the capabilities, like this:
story
stories
An array of the capabilities for this post type. Specify capabilities like this:
publish_posts : publish_posts
edit_post : edit_post
edit_posts : edit_posts
read_post : read_post
delete_post : delete_post
etc...
Whether to expose this post type in the REST API. Set this to true for the post type to be available in the block editor
The base slug that this post type will use when accessed using the REST API
An optional custom controller to use instead of WP_REST_Posts_Controller. Must be a subclass of WP_REST_Controller
The pro version allows developers to manually activate Post Typesindividually using the “Active” switch in the sidebar.
The module comes with additional settings that allows an advanced control over post types.
Setting | Description |
Front: Archive Posts per page | Set posts per page |
Front: Archive Order/Orderby | Set order/orderby setting |
Front: Single Template | Set custom template. Example: my-single.php |
Front: Archive Template | Set custom template: Example: my-archive.php |
Admin: List Posts Per Page | Set posts per page |
Admin: List Order/Order by | Set order/orderby setting |
Admin: Archive Page | Add an Archive Option Page under the post type menu. See Post Type Archive location |
It is possible to export and import Post Types in a Json file using the ACF > Tools menu. Post Types can also be exported in PHP format, to manually register them in the functions.php
file. Those tools are also available directly within the Dynamic Post Types UI.
Post Types can be registered using register_post_type()
and benefit from ACF Extended advanced settings like “Front: Archive Posts per page” or “Admin: List Order/Order by”. See documentation. Usage example:
add_action('init', 'my_init');
function my_init(){
register_post_type('my-post-type', array(
// Label
'label' => 'My Post Type',
// Front: Archive
'acfe_archive_template' => 'my-archive.php',
'acfe_archive_ppp' => 999,
'acfe_archive_orderby' => 'title',
'acfe_archive_order' => 'ASC',
// Front: Single
'acfe_single_template' => 'my-single.php',
// Admin
'acfe_admin_archive' => true,
'acfe_admin_ppp' => 999,
'acfe_admin_orderby' => 'title',
'acfe_admin_order' => 'ASC',
));
}
Advanced settings can be used in already existing post types using the register_post_type_args
hook. See documentation. Usage example:
add_filter('register_post_type_args', 'my_post_type_args', 10, 2);
function my_post_type_args($args, $post_type){
// target "my-post-type"
if($post_type === 'my-post-type'){
// set front: posts per page
$args['acfe_archive_ppp'] = 999;
}
// return
return $args;
}
ACF Extended use the native ACF setting show_admin
to determine if the module menu should be displayed or not. You can read more about that setting on the ACF article How to hide ACF menu from clients. Usage example:
add_filter('acf/settings/show_admin', '__return_false');
The Post Types module is enabled by default. It can be enabled and disabled in the Settings UIPRO, or with the following code:
// Using acf/init
add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){
// Disable Post Types
acf_update_setting('acfe/modules/post_types', false);
}
// Or using acfe/init
add_action('acfe/init', 'my_acfe_modules');
function my_acfe_modules(){
// Disable Post Types
acfe_update_setting('modules/post_types', false);
}