#16590 closed defect (bug) (invalid)
get_page_by_title doesn't work for cutom pages
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
get_page_by_title() queried for custom pages returns NULL
Change History (4)
comment:2
duck_
— 2 years ago
- Keywords reporter-feedback close added
If you mean it's not working for custom post types are you correctly specifying the post type you want to look up?
The function signature is:
get_page_by_title($page_title, $output = OBJECT, $post_type = 'page')
So if you want to retrieve an 'album' post type, for example, you would use:
get_page_by_title( 'Album Title', OBJECT, 'album' )
comment:3
johnbillion
— 22 months ago
- Keywords reporter-feedback close removed
- Resolution set to invalid
- Status changed from new to closed
Definitely works as expected with the $post_type parameter in place.
comment:4
SergeyBiryukov
— 22 months ago
- Milestone Awaiting Review deleted
Note: See
TracTickets for help on using
tickets.
sorry, I have forgotten WP 3.0.5