get_page_by_path

Sponsored Link

パスを取得するページを取得します。

Sponsored Link

Retrieves a page given its path.

get_page_by_pathのファンクションタグ使用方法

<?php get_page_by_path( $page_path, $output, $post_type ) ?>

get_page_by_pathのパラメーター

$page_path

(string) (required) ページパス。
Default: なし

(string) (required) Page path
Default: None

$output

(string) (optional)タイプを出力します。OBJECT, ARRAY_N, あるいは ARRAY_A
デフォルト:OBJECT

(string) (optional) Output type. OBJECT, ARRAY_N, or ARRAY_A.
Default: OBJECT

$post_type

(string) (optional) 投稿タイプ。
デフォルト:ページ

(string) (optional) Post Type.
Default: page

戻り値

(mixed)
完了時にnullを返します。

(mixed)
Null when complete.

ページ名

これは’pagename’クエリーと同等です:’index.php?pagename=parent-page/sub-page’.

上記のコードは、下記のように(‘parent-page/sub-page’を仮定することは、実際にページへのパスです。)として記述することも出来ます。

This is the equivalent of the ‘pagename’ query, as in: ‘index.php?pagename=parent-page/sub-page’.

Code for the above could be written as (assuming ‘parent-page/sub-page’ is actually the path to a page):

get_page_by_path('parent-page/sub-page');

注釈

Uses global: (object) $wpdb

変更ログ

Since: 2.1.0

ソースファイル

get_page_by_path() は、wp-includes/post.php内に位置しています。

get_page_by_path() is located in wp-includes/post.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()

Sponsored Link