您的当前位置:首页 > 知识博客 > wordpress建站

WordPress获取子页面对象函数:get_page_children

时间:2024-03-09

WordPress函数get_page_children用于获取子页面对象

get_page_children( int $page_id, array $pages )

函数参数

$page_id

整数

父页面ID

$pages

数组

页面列表对象,用get_pages()函数获取

函数返回值

Array
(
    [0] => WP_Post Object
        (
            [ID] => 15
            [post_author] => 1
            [post_date] => 2020-11-27 16:37:42
            [post_date_gmt] => 2020-11-27 08:37:42
            [post_content] => 
            [post_title] => 联系我们
            [post_excerpt] => 
            [post_status] => publish
            [comment_status] => open
            [ping_status] => closed
            [post_password] => 
            [post_name] => contact
            [to_ping] => 
            [pinged] => 
            [post_modified] => 2021-02-22 11:00:05
            [post_modified_gmt] => 2021-02-22 03:00:05
            [post_content_filtered] => 
            [post_parent] => 2
            [guid] => https://www.tiezhushuo.com/?page_id=15
            [menu_order] => 0
            [post_type] => page
            [post_mime_type] => 
            [comment_count] => 0
            [filter] => raw
        )

)

函数使用示例

$all_pages = get_pages( array(
	'post_type'         => 'page',
	'post_status'       => array( 'publish', 'pending' )
) );
$inherited = get_page_children(2, $all_pages);


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 baidu.bond


Whatsapp