Opened 10 years ago
Last modified 6 years ago
#30184 new defect (bug)
Author page and category
Reported by: | dimitrov.adrian | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Query | Keywords: | has-patch needs-unit-tests needs-testing |
Focuses: | Cc: |
Description
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; }
Attachments (1)
Change History (7)
#4
in reply to:
↑ 2
@
10 years ago
Replying to boonebgorges:
But if we query a author page with category param
How do you do this?
example.com/author/boone?cat=foo
?
yes
Note: See
TracTickets for help on using
tickets.
How do you do this?
example.com/author/boone?cat=foo
?