get_post_type_object()通过文章类型名词获取该类型的信息

目录

描述

Retrieves an object which describes any registered post type (i.e. built-in types like 'post' and 'page', or any user-created custom post type).

get_post_type_object() 描述

用法

<?php get_post_type_object$post_type ); ?>

get_post_type_object() 用法

参数

$post_type

(string) (必填) The name of the post type as used when registering the post type.

默认值: None

get_post_type_object() 参数

返回值

(object) 

on success.

Nothing on failure (e.g. can check for null).

get_post_type_object() 返回值

示例

Technically, this is the same as

print_r( $obj ) might return something like this:

Assuming we have the post type 'certification', we could do this:

print_r( $obj ) might return something like this:

Note that the object's attribute names are slightly different than the arguments expected for the register_post_type() function.

get_post_type_object() 示例

历史

  • 添加于 版本: 3.0

get_post_type_object() 历史

源文件

get_post_type_object() 函数的代码位于 wp-includes/post.php.

get_post_type_object() 源文件

相关