How to set a default format for a custom post type?

I created a custom post type for my blog, to allow easier separation of content. This new post type supports different post formats, but most of them will be galleries.

register_post_type('atelier',
    array(
    'label' => 'L\'Atelier',
    'public' => true,
    'supports' => array('title', 'editor', 'post-formats')
    )
);

I saw that it is possible in Settings -> Writing to set the default post format for posts, is it possible to do the same for my newly created post type?

3 s
3

One option would be to modify the global Default Post Format setting, via Dashboard -> Settings -> Writing.

Note that this setting is global, so it would set the default for all post types that support Post Formats.

If you have no need of post formats for blog Posts, you could simply enable post-format support only for your custom post type, by removing post-format support for blog posts:

<?php
remove_post_type_support( 'post', 'post-formats' );
?>

(Untested, but I see no reason why it shouldn’t work.)

Leave a Comment