首页 WordPress函数大全 get_page_by_path()

get_page_by_path()

2020-05-01 / 5328阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

get_page_by_path( string $page_path, string $output = OBJECT, string|array $post_type = 'page' )

Retrieves a page given its path.

描述

参数

$page_path

(string)
(Required)
Page path.

$output

(string)
(Optional)
The required return type.>WP_Post object, an associative array, or a numeric array, respectively.

Default value: OBJECT

$post_type

(string|array)
(Optional)
Post type or array of post types.

Default value: 'page'

返回

(WP_Post|array|null) WP_Post (or array) on success, or null on failure.

大家谈论
    我的见解