Opened 4 months ago
Last modified 2 months ago
#63656 new defect (bug)
get_page_by_path $post_type supports string and array but the check in the loop is checking by string
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 6.8 |
| Component: | Posts, Post Types | Keywords: | has-patch needs-testing reporter-feedback |
| Focuses: | Cc: |
Description
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 $page = get_page_by_path('/parent/child/', OBJECT, array('page'));
Change History (9)
This ticket was mentioned in PR #9190 on WordPress/wordpress-develop by @vipulgupta003.
4 months ago
#1
- Keywords has-patch added; needs-patch removed
This ticket was mentioned in Slack in #core-test by oglekler. View the logs.
4 months ago
#4
@
4 months ago
- Keywords needs-testing removed
- Version set to 6.8
Patch Testing
Description
Tested the patch for Ticket #63656: Twenty Seventeen theme should use the_excerpt() instead of the_content() on search and archive pages.
Environment
- WordPress: 6.8.1
- PHP: 8.2.23
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.23)
- Browser: Chrome 138.0.0.0
- OS: Windows 10/11
- Theme: Twenty Seventeen 3.9
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Steps to Reproduce
- Create a post with content and an excerpt.
- View search results or archive page.
- See the full content appearing.
- Apply the patch from the ticket.
- View again → now only the excerpt appears.
Expected Results
✅ Excerpt should be shown on archive/search pages.
Actual Results
✅ Excerpt is shown. Patch works as expected.
Additional Notes
No layout/design issues. Works well with existing posts.
#5
follow-up:
↓ 6
@
4 months ago
- Keywords needs-testing added
@dilip2615 your test report appears to be for a different ticket?
#6
in reply to:
↑ 5
@
4 months ago
Replying to mindctrl:No testing for this current ticket.
@dilip2615 your test report appears to be for a different ticket?
#7
follow-up:
↓ 8
@
4 months ago
@dilip2615 your test report refers to "Twenty Seventeen theme should use the_excerpt() instead of the_content() on search and archive pages.", but that is not what this ticket is about.
This ticket is about get_page_by_path throwing PHP warnings.
Track ticket : https://core.trac.wordpress.org/ticket/63656