0
나는 metabols의 선택 메뉴에 하위 페이지를 추가하기 위해 post_parent
ID를 확인하는 몇 가지 인수가 있습니다.Get_Posts에서 슬러그를 사용하는 Post_Parent 가져 오기 args
그러나 나는 페이지의 ID를 사용하지 않을 것이지만 변경 될 수는 있지만 슬러그는 항상 동일합니다.
// POST
array(
'name' => esc_html__('Select the previous page for the button link', 'uhd'),
'id' => "{$prefix}prev_target",
'type' => 'post',
// Post type
'post_type' => 'page',
// Field type, either 'select' or 'select_advanced' (default)
'field_type' => 'select_advanced',
'placeholder' => esc_html__('Select an Item', 'uhd'),
// Query arguments (optional). No settings means get all published posts
'query_args' => array(
'post_status' => 'publish',
'posts_per_page' => - 1,
'post_parent' => 18,
),
),
는 https://codex.wordpress.org/Template_Tags/get_posts