pre_get_network_by_path

過濾鉤子
apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths )
引數
  • (null|false|WP_Network) $network Network value to return by path. Default null to continue retrieving the network.
    Required:
  • (string) $domain The requested domain.
    Required:
  • (string) $path The requested path, in full.
    Required:
  • (int|null) $segments The suggested number of paths to consult. Default null, meaning the entire path was to be consulted.
    Required:
  • (string[]) $paths Array of paths to search for, based on `$path` and `$segments`.
    Required:
定義位置
相關勾子
pre_get_site_by_pathpre_get_networksget_networkparse_network_querypre_get_block_template
相關方法
get_network_by_pathget_category_by_pathwp_get_networkget_network_optionget_site_by_pathget_page_by_path
引入
3.9.0
棄用
-

pre_get_network_by_path – 這個鉤子在多站點設定中按路徑檢索網路之前被呼叫。開發人員可以使用這個鉤子來修改網路查詢,或者根據路徑提供一個自定義的網路。

通過域和路徑確定一個網路。

這使得人們可以繞過預設的邏輯,也許可以用一個更適合你的設定的程式來代替它。

返回null以避免短路。如果在請求的域和路徑上沒有找到網路,返回false。否則,從wp_get_network()返回一個物件。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths );
$pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths );
$pre = apply_filters( 'pre_get_network_by_path', null, $domain, $path, $segments, $paths );

常見問題

FAQs
檢視更多 >