WordPress获取登录用户信息函数:get_currentuserinfo

WordPress函数get_currentuserinfo用于获取当前登录用户信息,自4.5.0版本起,已不建议使用get_currentuserinfo,请换用wp_get_c …

WordPress获取当前登录用户对象数据函数:wp_get_current_user

WordPress函数wp_get_current_user用于获取当前已登录用户的对象数据,该函数没有可用的参数。 wp_get_current_user() 函数返回值wp_get_current_user()函数返回W …

WordPress设置当前登录用户函数:wp_set_current_user

WordPress函数wp_set_current_user用于更改当前登录的用户,例如管理员代管用户的场景。 wp_set_current_user( int|null $id, string $name = '' ) 函数参数$id 整数 用户ID $name 字符串 如果无法提供用户ID …

WordPress更改当前用户函数:set_current_user

WordPress函数set_current_user用于更改当前登录用户,在一些需要代登录的场景比较有用。自WordPress 3.0.0版本起,已不建议使用set_current …

WordPress获取用户文章数量函数:get_usernumposts

WordPress函数get_usernumposts用于获取用户发表的文章总数,自3.0.0版本起,已不建议使用get_usernumposts(),请换用count_user_ …

WordPress根据登录用户名获取用户信息函数:get_profile

WordPress函数get_profile根据登录用户名(例如:admin)获取用户信息,该函数自3.0.0版本起,已不推荐使用,请使用get_the_author_meta() …

WordPress获取作者函数:get_the_author

WordPress函数get_the_author用于获取作者的名称,返回名称为个人资料中“公开显示为”选项设置。 get_the_author( string $deprecated = '' ) 函数参数$deprecated 字符串,默认为空 自2.1 …

WordPress获取文章内容函数:get_the_content

WordPress函数get_the_content用于获取文章内容,通常用在主循环The Loop中。 get_the_content( string $more_link_text = null, bool $strip_teaser = false, WP_Post|object|int $post = null ) 函数参数$more_link_text 字符串,默认 …

WordPress获取当前Post ID函数:get_the_ID

WordPress函数get_the_ID一般用在主循环The Loop中,以获取当前Post ID。也可以在文章模板、页面模板中使用,在这些页面即使主循环之外也能获取到当前页面的ID …

WordPress添加元数据设置项函数:add_meta_box

WordPress添加元数据设置项函数:add_meta_box

WordPress函数add_meta_box用于为指定文章类型添加元数据设置项,例如可以为文章添加一个关键词设置单元。 add_meta_box( string $id, string $title, callable $callback, string|array|WP_Screen $screen = null, string $context = 'advanced', string $priority = 'default', array $callback_args = null ) 函数参数$i …