[wp-trac] [WordPress Trac] #19012: get_ID and the_ID should accept $id as a parameter
WordPress Trac
wp-trac at lists.automattic.com
Thu Oct 20 05:04:47 UTC 2011
#19012: get_ID and the_ID should accept $id as a parameter
-------------------------------------------------+-------------------------
Reporter: peterchester | Owner:
Type: enhancement | peterchester
Priority: normal | Status: new
Component: Post Types | Milestone: Awaiting
Severity: normal | Review
Keywords: has-patch needs-testing needs-codex | Version: 3.3
| Resolution:
-------------------------------------------------+-------------------------
Comment (by peterchester):
It's pretty straight forward. Basically, I see a TON of repeated code all
over the place that basically looks like this:
{{{
function myfunction ($post_id = null) {
if ($post_id == null) {
$post_id = get_ID();
}
...
}
}}}
I'm proposing that we abstract that effort to the get_ID function itself
so that one could simply do this:
{{{
function myfunction ($post_id = null) {
$post_id = get_ID( $post_id );
...
}
}}}
It should have no effect on existing code at all since it's an optional
parameter, but moving forward it could be super helpful to everyone.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19012#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list