[wp-trac] [WordPress Trac] #51582: Post type archive is loaded when post type does not allow

WordPress Trac noreply at wordpress.org
Wed Oct 21 01:16:36 UTC 2020


#51582: Post type archive is loaded when post type does not allow
--------------------------+-----------------------------
 Reporter:  manfcarlo     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If a post type is registered with `'has_archive' = false`, it should not
 be possible to load an archive of its posts.

 As per my testing, this can be fixed by unsetting
 `WP::query_vars['post_type']` when `WP::query_vars['name']` is empty and
 the post type does not allow archive.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51582>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list