Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#12827 closed defect (bug) (fixed)

get_post_type() is incorrect

Reported by: rmccue Owned by: rmccue
Priority: normal Milestone: 3.0
Component: Posts, Post Types Version: 3.0
Severity: normal Keywords: has-patch 2nd-opinion
Cc: Focuses:

Description

The inline documentation for get_post_type() is incorrect in stating that the function uses the current post if none is specified.

Either the function needs to be changed to use the current post, or the inline documentation needs to be correct. As nacin pointed out, the function is @since 2.1.0, so the former is most likely a bad idea.

I think the function should be deprecated in favour of a function that has the correct functionality, and the old function's documentation should be corrected.

Attachments (2)

12827-corrected.diff​ (786 bytes ) - added by rmccue 17 years ago.
Corrected version of the original function, so it matches the phpDoc
12827-corrected-2.diff​ (905 bytes ) - added by rmccue 17 years ago.
Change the phpDoc's param name to match new param

Download all attachments as: .zip

Change History (5)

@rmccue
17 years ago

Corrected version of the original function, so it matches the phpDoc

#1 @rmccue
17 years ago

  • Status new → accepted

Someone on the ​forums mentioned that it stopped working after upgrading to 2.7.1. Perhaps the format of $posts was changed?

#2 @rmccue
17 years ago

  • Keywords has-patch 2nd-opinion added

@rmccue
17 years ago

Change the phpDoc's param name to match new param

#3 @dd32
17 years ago

  • Resolution → fixed
  • Status accepted → closed

(In [14071]) Update get_post_type() to perform on the current global post if none specified. Update PHPDoc to reflect changes. Props rmccue. Fixes #12827

Note: See TracTickets for help on using tickets.