wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



get_post_type_object › WordPress Function

Da3.0.0
Deprecaton/a
get_post_type_object ( $post_type )
Parametri:
  • (string) $post_type The name of a registered post type.
    Richiesto:
Vedi:
Ritorna:
  • (WP_Post_Type|null) WP_Post_Type object if it exists, null otherwise.
Definito a:
Codex:
ChangeLog:
  • 4.6.0

Retrieves a post type object by name.



Sorgenti

function get_post_type_object( $post_type ) {
	global $wp_post_types;

	if ( ! is_scalar( $post_type ) || empty( $wp_post_types[ $post_type ] ) ) {
		return null;
	}

	return $wp_post_types[ $post_type ];
}