[wp-trac] [WordPress Trac] #63656: get_page_by_path $post_type supports string and array but the check in the loop is checking by string
WordPress Trac
noreply at wordpress.org
Wed Jul 2 17:57:26 UTC 2025
#63656: get_page_by_path $post_type supports string and array but the check in the
loop is checking by string
-------------------------------+-----------------------------
Reporter: salimali | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 6.8
Severity: normal | Keywords: needs-patch
Focuses: |
-------------------------------+-----------------------------
In the {{{get_page_by_path}}} function, {{{$post_type}}} supports string
and array, but the check in the loop is checking by string
https://github.com/WordPress/wordpress-develop/blob/6.8.1/src/wp-
includes/post.php#L6135, which throws {{{PHP Warning: Array to string
conversion in /var/www/html/wp-includes/post.php on line 6135.}}} Example
below:
{{{#!php
<?php
$page = get_page_by_path('/parent/child/', OBJECT, array('page'));
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63656>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list