_get_post_ancestors

函式
_get_post_ancestors ( $post )
引數
  • (WP_Post) $post Post object, passed by reference (unused).
    Required:
相關
  • get_post_ancestors()
定義位置
相關方法
get_post_ancestorsget_ancestorsget_post_customwp_get_post_catswp_get_post_categories
引入
2.3.4
棄用
3.5.0

_get_post_ancestors是一個WordPress函式,它返回一個特定文章的祖先的文章ID陣列: 這個函式在建立分層導航選單時很有用,你需要顯示一個頁面的列表和它們的父/子關係。它需要一個引數,即要尋找祖先的文章的ID。

檢索文章的祖先。

由於WP_Post通過get_post_ancestors()懶得載入祖先屬性,所以不再需要這個。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function _get_post_ancestors( &$post ) {
_deprecated_function( __FUNCTION__, '3.5.0' );
}
function _get_post_ancestors( &$post ) { _deprecated_function( __FUNCTION__, '3.5.0' ); }
function _get_post_ancestors( &$post ) {
	_deprecated_function( __FUNCTION__, '3.5.0' );
}

常見問題

FAQs
檢視更多 >