can_edit_network

函式
can_edit_network ( $network_id )
引數
  • (int) $network_id The network ID to check.
    Required:
返回值
  • (bool) True if network can be edited, otherwise false.
定義位置
相關方法
get_networkwp_get_networkget_networksupgrade_networkinstall_network
引入
3.1.0
棄用
-

can_edit_network: 該函式用於檢查當前使用者是否可以編輯網路。它不接受任何引數,並返回一個布林值,表明使用者是否有許可權編輯網路。

我們是否可以從這個頁面編輯這個網路。

預設情況下,網路的編輯僅限於該`$network_id`的網路管理員: 這個函式允許覆蓋這一點。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function can_edit_network( $network_id ) {
if ( get_current_network_id() === (int) $network_id ) {
$result = true;
} else {
$result = false;
}
/**
* Filters whether this network can be edited from this page.
*
* @since 3.1.0
*
* @param bool $result Whether the network can be edited from this page.
* @param int $network_id The network ID to check.
*/
return apply_filters( 'can_edit_network', $result, $network_id );
}
function can_edit_network( $network_id ) { if ( get_current_network_id() === (int) $network_id ) { $result = true; } else { $result = false; } /** * Filters whether this network can be edited from this page. * * @since 3.1.0 * * @param bool $result Whether the network can be edited from this page. * @param int $network_id The network ID to check. */ return apply_filters( 'can_edit_network', $result, $network_id ); }
function can_edit_network( $network_id ) {
	if ( get_current_network_id() === (int) $network_id ) {
		$result = true;
	} else {
		$result = false;
	}

	/**
	 * Filters whether this network can be edited from this page.
	 *
	 * @since 3.1.0
	 *
	 * @param bool $result     Whether the network can be edited from this page.
	 * @param int  $network_id The network ID to check.
	 */
	return apply_filters( 'can_edit_network', $result, $network_id );
}

常見問題

FAQs
檢視更多 >