Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#13747 closed defect (bug) (fixed)

Deprecate is_term, is_taxonomy, is_post_type for *_exists()

Reported by: nacin's profile nacin Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

Simply too much confusion, even with proper Codex documentation. post_type_exists() explains a lot more than is_post_type() anyway.

We should reserve is_ for conditional tags as much as possible (aside from functions clearly unrelated such as is_user_logged_in).

I wouldn't mind seeing this in 3.0 final, all we're doing is throwing in a few deprecated functions that would wrap better-named functions.

Attachments (2)

13747.diff (13.7 KB) - added by nacin 14 years ago.
13747.2.diff (13.7 KB) - added by nacin 14 years ago.

Download all attachments as: .zip

Change History (13)

#1 @demetris
14 years ago

  • Cc dkikizas@… added
  • Version set to 3.0

+1

I just logged in to open this ticket, and saw you had already done it. :-)

I only have a small reservation about is_term() because, unlike the other two, this does a bit more than a simple term_exists().

#2 @t31os_
14 years ago

+1

I am inclined to agree with demetris though, is_term i'm not too fussed about, but both is_tax and is_post_type are not appropriately named.

I've just answered a thread relating to this very issue, where users were using is_post_type as a conditional statement, not user error really, it's misleading.

@nacin
14 years ago

#3 @nacin
14 years ago

  • Keywords has-patch added
  • Milestone changed from Unassigned to 3.0

#4 @demetris
14 years ago

There seems to be a mistake in the patch:

deprecated.php redefines term_exists() instead of defining is_term() and making it call term_exists().

@nacin
14 years ago

#5 @nacin
14 years ago

  • Keywords commit added

Patch refreshed. Thanks demetris.

Not sure if we were all in agreement on doing this now, I know westi liked this. Marking for commit and we can decide tomorrow.

#6 @ryan
14 years ago

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

(In [15220]) Deprecate is_term, is_taxonomy, is_post_type for *_exists(). Props nacin. fixes #13747

#7 @westi
14 years ago

(In [15230]) Fell the dead wood. No point keeping a function as deprecated we only just introduced. See #13747

#8 @hakre
14 years ago

  • Summary changed from Deprecate is_term, is_taxonomy, is_post_type for *_exists() to Deprecate is_term and is_taxonomy for *_exists()

That third function does not exists, I could only find a is_post_type_hierarchical() function so far that starts with is_post.

#9 follow-up: @demetris
14 years ago

@hakre

The third function was:

@deprecated 3.0.0

@since 3.0.0

For this reason, westi removed it in r15230.

#10 in reply to: ↑ 9 @hakre
14 years ago

Replying to demetris:

@hakre

The third function was:

@deprecated 3.0.0 ..

Oh sure, that's what I thought as well, but I just wanted to explain why I removed it from the tickets title because it might become misleading.

#11 @nacin
14 years ago

  • Summary changed from Deprecate is_term and is_taxonomy for *_exists() to Deprecate is_term, is_taxonomy, is_post_type for *_exists()
Note: See TracTickets for help on using tickets.