WordPress修改文章状态为公开:wp_publish_post

WordPress函数wp_publish_post用于修改文章的状态为publish wp_publish_post( int|WP_Post $post ) 函数参数$post 整数 要修改的文章ID 扩展阅读wp_publish_post()函数位 …

WordPress更新文章函数:wp_update_post

WordPress函数wp_update_post用于更新现有的文章 wp_update_post( array|object $postarr = array(), bool $wp_error = false, bool $fire_after_hooks = true ) 函数参数$postarr 数组 可用值参考wp_insert_post()函数的$pos …

WordPress插入文章函数:wp_insert_post

WordPress函数wp_insert_post用于插入一篇新的文章。 wp_insert_post( array $postarr, bool $wp_error = false, bool $fire_after_hooks = true ) 函数参数$postarr 数组 ID:文章的ID,如果传递0以外的值,则更新相应ID的文 …

WordPress删除文章函数:wp_delete_post

WordPress函数wp_delete_post用于删除指定ID的文章 wp_delete_post( int $postid, bool $force_delete = false ) 函数参数$postid 整数 要删除的文章ID $force_delete 布尔值,默认值:false 是否绕过回收站直接删除 …

WordPress判断文章类型是否支持层级函数:is_post_type_hierarchical

WordPress函数is_post_type_hierarchical用于判断指定文章类型是否支持层级。 is_post_type_hierarchical( string $post_type ) 函数参数$post_type 字符串 文章类型名称 扩展阅读is_pos …

WordPress生成文章类型角色权限函数:get_post_type_capabilities

WordPress函数get_post_type_capabilities用于快速生成文章类型角色权限。 get_post_type_capabilities( object $args ) 函数参数$args 对象 参考register_post_type()函 …

WordPress获取文章类型对象函数:get_post_type_object

WordPress函数get_post_type_object根据文章类型名称获取文章类型数据,返回的结果参考get_post_types()函数$output值为objects时 …

WordPress获取指定文章类型的文章列表链接:get_post_type_archive_link

WordPress函数get_post_type_archive_link用于获取指定文章类型的文章列表链接。 get_post_type_archive_link( string $post_type ) 函数参数$post_type 字符串 文章类型 函数使用示例< …

WordPress获取所有文章类型函数:get_post_types

WordPress函数get_post_types用于获取所有文章类型信息。 get_post_types( array|string $args = array(), string $output = 'names', string $operator = 'and' ) 函数参数$args 数组或字符串 根据传递的参数返回符合条件的文章类型,以下示例 …

WordPress根据文章ID获取文章类型函数:get_post_type

WordPress函数get_post_type获取当前文章或指定文章的文章类型,在The Loop主循环中使用则不需要传递文章ID。 get_post_type( int|WP_Post|null $post = null ) 函数参数$post 整数或WP_Pos …