Make WordPress Core

Opened 8 years ago

Closed 4 years ago

Last modified 4 years ago

#35163 closed defect (bug) (worksforme)

wp_get_archives() returns unresolved query string

Reported by: hogetan's profile hogetan Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Posts, Post Types Keywords:
Focuses: Cc:


wp_get_archives() function returns unresolved query string.

such as

// called wp_get_archives('post_type=test&type=monthly')

Looks duplicate query parse filter or add_query_arg() not working.

refs #21596

Attachments (1)

remove_query_string.patch (2.4 KB) - added by hogetan 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @mikeschroder
8 years ago

  • Version changed from trunk to 4.4

This ticket was mentioned in Slack in #core by noisysocks. View the logs.

4 years ago

#3 @dd32
4 years ago

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

It looks to me that this is working as expected.

The archives that the function deals with, are all post-specific.

Another example:
wp_get_archives('post_type=page&type=monthly' );
will generate links like this:

Those URLs will 404 unless the post_type specified has also been included into the global posts loops through a pre_get_posts filter.

It feels like the original report here had other filters in use which were adding the post_type into the URI, potentially the month_link filter or from within $wp_rewrite->get_month_permastruct().

I'm going to close this as worksforme, since it seems correct. If you're experiencing this issue, please feel free to re-open with specifics on how to reproduce on a clean environment without other filters.

#4 @dd32
4 years ago

  • Component changed from General to Posts, Post Types
Note: See TracTickets for help on using tickets.