Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#12950 closed enhancement (fixed)

Introduce is_post_type_hierarchical()

Reported by: ptahdunbar's profile ptahdunbar Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

Patch adds a new is_post_type_hierarchical() function to wp-includes/post.php.

It accepts one parameter which can be the post type name, id, or a post object and it will return a boolean result.

Attachments (1)

is_post_type_hierarchical.diff (944 bytes) - added by ptahdunbar 13 years ago.

Download all attachments as: .zip

Change History (5)

#1 @dd32
13 years ago

(In [14053]) Introduce is_post_type_hierarchical(). Props ptahdunbar. See #12950

#2 @dd32
13 years ago

Leaving this open for implementation throughout WordPress.

I changed the patch slightly, adding a few sanity checks to prevent PHP Warnings (Accessing non-existant properties, attempting to use a object as a array indicy, etc)

#3 @nacin
13 years ago

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

(In [14155]) Use is_post_type_hierarchical and is_taxonomy_hierarchical when we're fetching a post/tax object only to check the hierarchical flag. fixes #12950.

#4 @nacin
13 years ago

These were found in a search for '->hierarchical'. I didn't switch over any hierarchical checks when we used the post type object to check other properties.

Note: See TracTickets for help on using tickets.