WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

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

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
3 years ago

https://codex.wordpress.org/Reserved_Terms

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

#2 @SergeyBiryukov
3 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
3 years ago

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

#4 @MateuszP1
3 years ago

ahh, ok thanks!

Note: See TracTickets for help on using tickets.