[wp-trac] [WordPress Trac] #23162: parent_dropdown() should except WP Post object as additional argument
WordPress Trac
noreply at wordpress.org
Wed Jan 9 22:48:08 UTC 2013
#23162: parent_dropdown() should except WP Post object as additional argument
-----------------------------+------------------------------
Reporter: charliespider | Type: enhancement
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Warnings/Notices
Version: | Severity: normal
Keywords: |
-----------------------------+------------------------------
parent_dropdown() can no longer be used outside of the loop, such as
within the wp-admin, because an E_NOTICE will be emitted in
template.php:683 since $post is null.
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/23162>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list