Ticket #12647 (new defect (bug))
$wp_query doesn't report the full pagename for nested pages
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | dphiffer |
Description
I've just discovered a bug in my JSON API plugin where it is unable to introspect on sub-pages. Instead of getting the page's data in JSON format (as you do for pages at the root level), the API returns the same response as if you had requested a non-existent page. Consider the following:
$pagename = get_query_var('pagename'); query_posts("pagename=$pagename");
If you run that code against a path like "/page/subpage/" you will get a 404. In this case the value of $pagename from the first line is going to be 'subpage', but the query_posts pagename parameter is expecting a full path like 'page/subpage'.
Change History
- Summary changed from $wp_query doesn't report the full pagename to $wp_query doesn't report the full pagename for nested pages
- Owner set to ryan
- Component changed from General to Query
- Milestone changed from Unassigned to Future Release
This is how WP_Query is written. It overrides pagename (full path) with just the page name itself.
Perhaps we should store the original full path in another var, or allow pagename to take optionally the page name only, not requiring the full path. Not sure how doable the latter is.
