[wp-trac] [WordPress Trac] #22247: Ensure post ID evaluates to true before adding "Edit post" tab in admin bar

WordPress Trac noreply at wordpress.org
Mon Aug 10 19:43:43 UTC 2015


#22247: Ensure post ID evaluates to true before adding "Edit post" tab in admin bar
------------------------------------+------------------------------
 Reporter:  Joe Anzalone            |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Toolbar                 |     Version:  3.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------
Changes (by morganestes):

 * keywords:  has-patch => has-patch dev-feedback


Comment:

 I've tested this out and it works in 4.3.0 trunk. Since we're using
 `$current_object->ID` as a parameter twice in the same `if` check, it
 makes sense to check it for a valid value beforehand.
 That also takes care of the example @Joe Anzalone provided with plugins
 creating their own posts with an ID of 0.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22247#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list