This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_ancestors/
Languages: English • 한국어 • 日本語 (Add your language)
주어진 객체의 부모를 포함하는 배열을 반환합니다.
<?php get_ancestors( $object_id, $object_type ); ?>
<?php $ancestors = get_ancestors( 6, 'page' ); ?>
다음과 같은 카테고리 계층이 주어졌을 때 (괄호 안의 숫자는 카테고리 ID) :
<?php get_ancestors( 208, 'category' ); ?>
반환값:
Array
(
[0] => 23
[1] => 6
)
다음과 같이 페이지 계층이 주어졌을 때 (괄호 안의 숫자는 페이지 ID) :
<?php get_ancestors( 448, 'page' ); ?>
반환값:
Array
(
[0] => 447
)
get_ancestors() 함수는 wp-includes/taxonomy.php 파일에 위치합니다.
Page Tags: get_all_page_ids(), get_ancestors(), get_page(), get_page_link(), get_page_by_path(), get_page_by_title(), get_page_children(), get_page_hierarchy(), get_page_uri(), get_pages(), is_page(), page_uri_index(), wp_list_pages(), wp_page_menu()