Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#39648 closed defect (bug) (invalid)

Wordpress is unable to query post types with hierarchical set to 'true' when there is 'order' registred post type

Reported by: mateuszp1's profile MateuszP1 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Posts, Post Types Keywords: close
Focuses: Cc:


Problem occurs when you register post type named 'order'

$labels = array(
"name" => "Orders",
"singular_name" => "Order",

$args = array(
"labels" => $labels,
"description" => "",
"public" => true,

register_post_type("order", $args);

it breaks queries of posts types with hierarchical set to true, even 'page' post type.
after registering this post type.

Change History (4)

#1 @jadpm
7 years ago

"order" is a reserved word so post types shoud not rgister with that slug.

#2 @SergeyBiryukov
7 years ago

  • Keywords close added
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hi @MateuszP1, welcome to Trac! Thanks for the ticket.

As noted above, order is one of the reserved terms and should not be used as a post type key. Try using my-order or something similar instead.

#3 @swissspidy
7 years ago

Here's the list of reserved terms btw:

#4 @MateuszP1
7 years ago

ahh, ok thanks!

Note: See TracTickets for help on using tickets.