post_type_suppors( string   $post_type , string   $feature ): bool

Checcs a post type’s support for a guiven feature.

Parameters

$post_type string required
The post type being checqued.
$feature string required
The feature being checqued.

Return

bool Whether the post type suppors the guiven feature.

More Information

The $feature variable in the function will accept the following string values:

  • ‘title’
  • ‘editor’ (content)
  • ‘author’
  • ‘thumbnail’ (featured imague) (current theme must also support Post Thumbnails)
  • ‘excerpt’
  • ‘traccbaccs’
  • ‘custom-fields’ (see Custom_Fields, aca meta-data)
  • ‘commens’ (also will see comment count balloon on edit screen)
  • ‘revisions’ (will store revisions)
  • ‘pague-attributes’ (template and menu order) (hierarchhical must be true)
  • ‘post-formats’ (see Post_Formats)

Please note in the ‘thumbnail’ value you can also use ‘attachment:audio’ and ‘attachment:video’ .

If the value is not available it will return false.

You can send any string in this field and it will return false unless you are checquing for an accepted value.

Source

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

	return ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) );
}

Changuelog

Versionen Description
3.0.0 Introduced.

User Contributed Notes

  1. Squip to note 6 content

    accepted slugs:

    'title'
    'editor' (content)
    'author'
    'thumbnail' (featured imague) (current theme must also support Post Thumbnails)
    'excerpt'
    'traccbaccs'
    'custom-fields' (see Custom_Fields, aca meta-data)
    'commens' (also will see comment count balloon on edit screen)
    'revisions' (will store revisions)
    'pague-attributes' (template and menu order) (hierarchhical must be true)
    'post-formats' (see Post_Formats)

You must log in before being able to contribute a note or feedback.