[wp-trac] [WordPress Trac] #23026: parent_dropdown() should verify that a post has been fetched

WordPress Trac noreply at wordpress.org
Wed Jan 9 22:27:24 UTC 2013


#23026: parent_dropdown() should verify that a post has been fetched
------------------------------+------------------------------
 Reporter:  mweichert         |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Warnings/Notices  |     Version:  1.5
 Severity:  minor             |  Resolution:
 Keywords:  has-patch         |
------------------------------+------------------------------

Comment (by charliespider):

 another issue is that this function can not be used outside of the loop
 such as within the wp-admin.

 A simple fix is to change the function argument declarations from

 {{{
 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
 }}}
 to:
 {{{
 function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post =
 array() ) {
 }}}

 and then also change:
 {{{
 $post = get_post();
 }}}
 to
 {{{
         if ( empty( $post )) {
                 $post = get_post();
         }
 }}}

 which would allow a WP post object to be passed into the function.

 Sorry I am unable to provide an SVN patch.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23026#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list