[wp-trac] [WordPress Trac] #30184: Author page and category
WordPress Trac
noreply at wordpress.org
Wed Oct 29 19:20:42 UTC 2014
#30184: Author page and category
-----------------------------+-----------------------------
Reporter: dimitrov.adrian | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
Got errors like next in debug.log
PHP Notice: Undefined property: stdClass::$ID in /www/test1/wp-
includes/query.php on line 4074
PHP Notice: Undefined property: stdClass::$nickname in /www/test1/wp-
includes/query.php on line 4076
PHP Notice: Undefined property: stdClass::$user_nicename in /www/test1
/wp-includes/query.php on line 4078
In wp-includes/query.php we have the method
{{{
public function is_author( $author = '' ) {
if ( !$this->is_author )
return false;
if ( empty($author) )
return true;
$author_obj = $this->get_queried_object();
$author = (array) $author;
if ( in_array( $author_obj->ID, $author ) )
return true;
elseif ( in_array( $author_obj->nickname, $author ) )
return true;
elseif ( in_array( $author_obj->user_nicename, $author ) )
return true;
return false;
}
}}}
But if we query a author page with category param queried_object actually
will be the category term object, so next patch prevent such problems
{{{
public function is_author( $author = '' ) {
if ( !$this->is_author )
return false;
if ( empty($author) )
return true;
$author_obj = $this->get_queried_object();
if ( ! is_a( $author_obj, 'WP_User' ) )
return false;
$author = (array) $author;
if ( in_array( $author_obj->ID, $author ) )
return true;
elseif ( in_array( $author_obj->nickname, $author ) )
return true;
elseif ( in_array( $author_obj->user_nicename, $author ) )
return true;
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30184>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list