#11624 closed enhancement (fixed)
Stop using $id global
Reported by: | scribu | Owned by: | |
---|---|---|---|
Milestone: | 3.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
We already have the $post global which has the ID field.
So the $id global can be replaced with $post->ID everywhere.
Attachments (2)
Change History (18)
#5
in reply to:
↑ 3
@
15 years ago
Replying to scribu:
Such as?
Subscribe to comments comes to mind. Or at least it did in prior versions. I'm sure we'd find a few by looking.
#6
@
15 years ago
- Keywords tested added
This shouldn't affect plugins that still use global $id since it will be still be set in setup_post_content(). Core functions will just stop using it. Its at least a small step in getting rid of all the globals.
#8
@
15 years ago
- Keywords tested commit removed
I would commit this, but we use $id
in a lot more places than post.php. It's not a bad idea to reduce our dependence on globals even by one, but we might as well do it across the board if we are to do it.
#9
follow-up:
↓ 10
@
15 years ago
Should we create a ticket with the grand project of getting rid of all globals for 3.1?
#10
in reply to:
↑ 9
;
follow-up:
↓ 11
@
15 years ago
Replying to xibe:
Should we create a ticket with the grand project of getting rid of all globals for 3.1?
Heh, yea, that's not going to happen so easily. :)
#11
in reply to:
↑ 10
@
15 years ago
Replying to nacin:
Heh, yea, that's not going to happen so easily. :)
I guess so :)
But that would most certainly appease a lot of developers who like to snark at the "code is poetry" motto.
#14
@
14 years ago
- Keywords commit added
- Milestone changed from Future Release to 3.1
Updated patch removes all instances of $id that I could find.
Remove $id global from the_ID(), get_the_ID() and get_the_content()