remove_post_type_support() WordPress Function

The remove_post_type_support() function is used to remove a specific feature from a post type. This is useful if you want to disable certain features on a post type, or if you want to create a custom post type that doesn't support certain features.

remove_post_type_support( string $post_type, string $feature ) #

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


Top ↑

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

Top ↑

Source

File: wp-includes/post.php

function remove_post_type_support( $post_type, $feature ) {
	global $_wp_post_type_features;

	unset( $_wp_post_type_features[ $post_type ][ $feature ] );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More