wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_get_current_commenter › WordPress Function
Since2.0.4
已弃用n/a
› wp_get_current_commenter ( 没有参数 )
查看: | |
返回: |
|
定义在: |
|
文档: |
Get current commenter's name, email, and URL.
Expects cookies content to already be sanitized. User of this function might wish to recheck the returned array for validity.
Related Functions: wp_get_current_user, _wp_get_current_user, wp_set_current_user, wp_count_comments, get_current_screen
源码
function wp_get_current_commenter() { // Cookies should already be sanitized. $comment_author = ''; if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) { $comment_author = $_COOKIE[ 'comment_author_' . COOKIEHASH ]; } $comment_author_email = ''; if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) { $comment_author_email = $_COOKIE[ 'comment_author_email_' . COOKIEHASH ]; } $comment_author_url = ''; if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) { $comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ]; } /** * Filters the current commenter's name, email, and URL. * * @since 3.1.0 * * @param array $comment_author_data { * An array of current commenter variables. * * @type string $comment_author The name of the author of the comment. Default empty. * @type string $comment_author_email The email address of the `$comment_author`. Default empty. * @type string $comment_author_url The URL address of the `$comment_author`. Default empty. * } */ return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) ); }