wp_get_user_contact_methods

函式
wp_get_user_contact_methods ( $user = null )
引數
  • (WP_User|null) $user Optional. WP_User object.
    Required:
    Default: null
返回值
  • (string[]) Array of contact method labels keyed by contact method.
定義位置
相關方法
_wp_get_user_contactmethodswp_update_user_countsget_user_countwp_is_large_user_countwp_get_recent_posts
引入
3.7.0
棄用
-

wp_get_user_contact_methods: 這個函式檢索一個使用者聯絡方法的陣列。它返回一個包含使用者聯絡方法的陣列,這些方法用於在使用者資料頁面顯示使用者的聯絡資訊。

設定使用者的聯絡方法。

在3.6版本中刪除了預設的聯絡方法。一個過濾器決定了聯絡方法。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_get_user_contact_methods( $user = null ) {
$methods = array();
if ( get_site_option( 'initial_db_version' ) < 23588 ) {
$methods = array(
'aim' => __( 'AIM' ),
'yim' => __( 'Yahoo IM' ),
'jabber' => __( 'Jabber / Google Talk' ),
);
}
/**
* Filters the user contact methods.
*
* @since 2.9.0
*
* @param string[] $methods Array of contact method labels keyed by contact method.
* @param WP_User|null $user WP_User object or null if none was provided.
*/
return apply_filters( 'user_contactmethods', $methods, $user );
}
function wp_get_user_contact_methods( $user = null ) { $methods = array(); if ( get_site_option( 'initial_db_version' ) < 23588 ) { $methods = array( 'aim' => __( 'AIM' ), 'yim' => __( 'Yahoo IM' ), 'jabber' => __( 'Jabber / Google Talk' ), ); } /** * Filters the user contact methods. * * @since 2.9.0 * * @param string[] $methods Array of contact method labels keyed by contact method. * @param WP_User|null $user WP_User object or null if none was provided. */ return apply_filters( 'user_contactmethods', $methods, $user ); }
function wp_get_user_contact_methods( $user = null ) {
	$methods = array();
	if ( get_site_option( 'initial_db_version' ) < 23588 ) {
		$methods = array(
			'aim'    => __( 'AIM' ),
			'yim'    => __( 'Yahoo IM' ),
			'jabber' => __( 'Jabber / Google Talk' ),
		);
	}

	/**
	 * Filters the user contact methods.
	 *
	 * @since 2.9.0
	 *
	 * @param string[]     $methods Array of contact method labels keyed by contact method.
	 * @param WP_User|null $user    WP_User object or null if none was provided.
	 */
	return apply_filters( 'user_contactmethods', $methods, $user );
}

常見問題

FAQs
檢視更多 >