remove_post_type_support( string $post_type, string $feature )
Removes support for a feature from a post type.
Parameters
-
$post_type
string Required -
The post type for which to remove the feature.
-
$feature
string Required -
The feature being removed.
More Information
All features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the edit screen.
Typically remove_post_type_support() should be attached to the ‘init’ action hook.
Possible values of parameter $feature
- ‘title’
- ‘editor’ (content)
- ‘author’
- ‘thumbnail’ (featured image) (current theme must also support Post Thumbnails)
- ‘excerpt’
- ‘trackbacks’
- ‘custom-fields’
- ‘comments’ (also will see comment count balloon on edit screen)
- ‘revisions’ (will store revisions)
- ‘page-attributes’ (template and menu order) (hierarchical must be true)
- ‘post-formats’ removes post formats, see Post Formats
Source
File: wp-includes/post.php
.
View all references
function remove_post_type_support( $post_type, $feature ) {
global $_wp_post_type_features;
unset( $_wp_post_type_features[ $post_type ][ $feature ] );
}
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Hide page visual editor if certain template is selected:
Credit: https://wordpress.stackexchange.com/a/91644/138483
Remove support for excerpts
This example removes support for excerpts in posts:
Remove support for post formats
This example removes support for post formats in posts:
A simple way to remove comments from all pages: