Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13843 closed enhancement (wontfix)

post_type_supports() returns true when $_wp_post_type_features['post_type']['feature'] is set but false

Reported by: linguasite's profile linguasite Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: 2nd-opinion
Focuses: Cc:

Description

Wouldn't it be safer to ask for a true value before returning true?

I had to change a capability manually and did this by directly changing the relevant value to false (without using remove_post_type_support for some reason).
post_type_supports() still returned true then.

wp-includes/post.php line 1031

Change History (4)

#1 @kevinB
14 years ago

  • Cc kevinB added

#2 follow-up: @nacin
14 years ago

  • Keywords 2nd-opinion added

You should use remove_post_type_support(). Modifying the internal array is not supported. Via add_post_type_support(), it will always equal either true, or an array. We could check for === false there, but I don't think we should need to. It's set, that's what matters. The "true" is just to have a value there (as with pluggable arg checking, it could be more than just "true").

#3 in reply to: ↑ 2 @linguasite
14 years ago

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

Thanks nacin, you are absolutely right.
I did some experiments and stumbled upon this phenomenon.

#4 @nacin
14 years ago

  • Milestone Awaiting Review deleted

Cheers.

Note: See TracTickets for help on using tickets.