Dynamic Post Types

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…

Dynamic Post Type

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.

  • Add new choice

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 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

The position in the menu order the post type should appear. show_in_menu must be true

The url to the icon to be used for this menu or the name of the icon from the iconfont (Dashicons)

Whether to generate a default UI for managing this post type in the admin

Where to show the post type in the admin menu. show_ui must be true

If an existing top level page such as 'tools.php' or 'edit.php?post_type=page', the post type will be placed as a sub menu of that page

Whether post_type is available for selection in navigation menus

Where to show the post type in the admin menu. show_ui must be true

/wp-content/themes/acf-extended/

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'.

/wp-content/themes/acf-extended/

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

Advanced Settings

The module comes with additional settings that allows an advanced control over post types.

SettingDescription
Front: Archive Posts per pageSet posts per page
Front: Archive Order/OrderbySet order/orderby setting
Front: Single TemplateSet custom template. Example: my-single.php
Front: Archive TemplateSet custom template: Example: my-archive.php
Admin: List Posts Per PageSet posts per page
Admin: List Order/Order bySet order/orderby setting
Admin: Archive PageAdd an Archive Option Page under the post type menu. See Post Type Archive location

Export/Import Post Types

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.

Register Post Types in PHP

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',
        
    ));
    
}

Existing Post Types

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')
        return $args;
    
    // Set Front: Posts Per Page
    $args['acfe_archive_ppp'] = 999;
    
    // Return
    return $args;
    
}

Disable the module

This module is enabled by default. To disable it, you can use the following code:

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // Disable Dynamic Post Types
    acfe_update_setting('modules/dynamic_post_types', false);
    
    // Or:
    acf_update_setting('acfe/modules/dynamic_post_types', false);
    
}