get_pages()

投稿日:2022-09-27 投稿者:PS カテゴリ:その他 タグ: , ,

固定ページの情報を返す。

<?php
$args = array(
	'sort_column' => 'post_title',  // post_title, post_name, post_author, ...
	'sort_order' => 'ASC',          // ASC, DESC
	'hierarchical' => 1,            // 子ページを、親の下にするか
	'exclude' => '',                // 除外するページのID(カンマ区切りの文字列)
	'include' => '',                // 対象とするページのID(カンマ区切りの文字列)
	'meta_key' => '',               // 対象にするカスタムフィールド key
	'meta_value' => '',             // 対象にするカスタムフィールドの値
	'authors' => '',
	'child_of' => 0,
	'parent' => -1,
	'exclude_tree' => '',
	'number' => '',
	'offset' => 0,
	'post_type' => 'page',          // page:固定ページ、post:投稿 ...
	'post_status' => 'publish'      // publish:公開、private, draft 
); 
$pages = get_pages( $args );