Make WordPress Core

Opened 7 months ago

Last modified 4 weeks ago

#25398 reopened defect (bug)

Multiple WordPress URL Parameters Causes Undefined ID and Nicename Errors

Reported by: chriscct7 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.6.1
Component: Query Keywords: has-patch 2nd-opinion
Focuses: Cc:


So I was able to find an unexpected behavior in WordPress that looks like it was patched in #17662 11 months ago, since a closely related ticket, #20519, was closed and merged into that one.

Basically, to reproduce this you need a custom post type that supports authors.

So, let's say I have a cpt called 'download'. Let's say a known author ID is 1. It doesn't really matter what the author id is. Now, try going to:


So what you'd expect to see, is the downloads archive template, with the posts written by author 1.

Instead what you get is undefined errors specifically undefined id and undefined nicename.

Not really sure where the bug comes from (my guess is maybe the templates for author and post type archives) so I've logged it under General.

Attachments (1)

25398.patch (429 bytes) - added by mordauk 3 months ago.
Add ! is_post_type_archive() to is_author() check

Download all attachments as: .zip

Change History (17)

comment:1 helen7 months ago

  • Keywords reporter-feedback added

What theme/template code?

comment:2 chriscct77 months ago

I'm not sure specifically which ones, but what I presume is happening is:
is_admin() returns true for this query, and is_archive() also returns true, so WordPress is either loading the author template, the archives template or possibly both. Let me see if I can track down something for you

comment:3 chriscct77 months ago

Notice: Undefined property: stdClass::$user_nicename in C:\wamp\www\edd\wp-includes\template.php on line 88
Call Stack
#	Time	Memory	Function	Location
1	0.0002	675064	{main}( )	..\index.php:0
2	0.0003	679880	require( 'C:\wamp\www\edd\wp-blog-header.php' )	..\index.php:17
3	0.2930	36454520	require_once( 'C:\wamp\www\edd\wp-includes\template-loader.php' )	..\wp-blog-header.php:16
4	0.2942	36455504	get_author_template( )	..\template-loader.php:38

Notice: Undefined property: stdClass::$ID in C:\wamp\www\edd\wp-includes\template.php on line 89
Call Stack
#	Time	Memory	Function	Location
1	0.0002	675064	{main}( )	..\index.php:0
2	0.0003	679880	require( 'C:\wamp\www\edd\wp-blog-header.php' )	..\index.php:17
3	0.2930	36454520	require_once( 'C:\wamp\www\edd\wp-includes\template-loader.php' )	..\wp-blog-header.php:16
4	0.2942	36455504	get_author_template( )	..\template-loader.php:38

Looks like the author template

Last edited 7 months ago by chriscct7 (previous) (diff)

comment:4 chriscct77 months ago

  • Keywords reporter-feedback removed

comment:5 chriscct77 months ago

So there's 2 ways this could affect a site.
The first way is you get the xdebug notices, like on the dev localhost site I have.

The second way, is if you've elected to hide those errors using php.ini, you get back a totally blank page, like on photomatt's site, where:

which is a blank page

Last edited 7 months ago by chriscct7 (previous) (diff)

comment:6 chriscct77 months ago

  • Keywords dev-feedback added

comment:7 nacin3 months ago

  • Component changed from General to Query

comment:8 mordauk3 months ago

get_queried_object() is returning the post type object but since the author query arg is set, is_author() returns true, which causes the undefined index error when the title is set to the author's name with $title = $author->display_name;.

This can be fixed by adding && ! is_post_type_archive() to the is_author() check.

I'm not sure if there are any repercussions of this though.

mordauk3 months ago

Add ! is_post_type_archive() to is_author() check

comment:9 mordauk3 months ago

  • Keywords has-patch added; needs-patch removed

comment:10 wonderboymusic3 months ago

  • Keywords close added; dev-feedback removed
  • Milestone changed from Awaiting Review to 3.9

Unless I'm missing something, this appears to be fixed....

Canonical redirection is kicking in:
http://wordpress-core-develop/?post_type=_type&post_author=1 redirects to

+ no errors when when pretty permalinks are off

comment:11 wonderboymusic3 months ago

  • Resolution set to fixed
  • Status changed from new to closed

Someone reopen if I'm wrong about this working just fine now.

comment:12 mordauk3 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Still throws notices for me:

http://trunk:8888/?post_type=download&author=1 redirects to http://trunk:8888/author/pippin/?post_type=download and shows the query results correctly, but there are still undefined notices in the header:


comment:13 mordauk2 months ago

  • Keywords 2nd-opinion added; close removed

comment:14 ircbot4 weeks ago

This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.

comment:15 follow-up: wonderboymusic4 weeks ago

  • Milestone changed from 3.9 to Future Release

I still can't reproduce this - @mordauk, what theme are you using?

comment:16 in reply to: ↑ 15 mordauk4 weeks ago

Replying to wonderboymusic:

I still can't reproduce this - @mordauk, what theme are you using?

I tested on multiple default themes, including Twenty Twelve and Twenty Thirteen.

Note: See TracTickets for help on using tickets.