WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#39417 closed defect (bug) (invalid)

get_queried_object() stopped working on author archive template in WP 4.7

Reported by: mekshq Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Query Keywords: reporter-feedback
Focuses: Cc:

Description

Hi,

In WP 4.7 get_queried_object() function doesn't work anymore if called inside author archive. It doesn't return anything. Also, get_queried_object_id() always returns 0.

This is working fine when permalinks are set to "plain" (i.e. ?author=5), but not if permalinks are set to "post name" (i.e. author/some-author-slug)

That's what we have found so far. Any feedback is highly appreciated.

Thanks,
Meks

Change History (4)

#1 follow-up: @johnbillion
2 years ago

  • Keywords reporter-feedback added

Thanks for the report, @mekshq.

I'm unable to reproduce this problem. get_queried_object() correctly returns the WP_User object for the archive author. Can you test this with one of the default themes active and all your plugins deactivated please?

#2 @SergeyBiryukov
2 years ago

  • Component changed from General to Query

#3 in reply to: ↑ 1 @mekshq
2 years ago

Replying to johnbillion:

Thanks for the report, @mekshq.

I'm unable to reproduce this problem. get_queried_object() correctly returns the WP_User object for the archive author. Can you test this with one of the default themes active and all your plugins deactivated please?

@johnbillion Thanks for reaching out! I have checked again and it seems it is working fine in version 4.7.4, so it must have been fixed somewhere between 4.7. and 4.7.4.

#4 @johnbillion
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.