Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 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 Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version: 4.7
Severity: normal Keywords: close
Cc: Focuses:

Description

Problem occurs when you register post type named 'order'

<?php
$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.
See:
wp-admin/edit.php?post_type=page
after registering this post type.

Change History (4)

#1 @jadpm
10 years ago

​https://codex.wordpress.org/Reserved_Terms

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

#2 @SergeyBiryukov
10 years ago

  • Keywords close added
  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → 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
10 years ago

Here's the list of reserved terms btw: ​https://codex.wordpress.org/Reserved_Terms

#4 @MateuszP1
10 years ago

ahh, ok thanks!

Note: See TracTickets for help on using tickets.