#23162 closed enhancement (fixed)
Allow to call parent_dropdown() for an arbitrary post
| Reported by: | charliespider | Owned by: | wonderboymusic |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.4 |
| Component: | Posts, Post Types | Version: | 1.5 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | administration |
Description
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.
Attachments (1)
Change History (8)
#1
@
14 years ago
- Summary parent_dropdown() should except WP Post object as additional argument → parent_dropdown() breaks becuause of recent changes. It should except WP Post object as additional argument
#2
@
14 years ago
- Summary parent_dropdown() breaks becuause of recent changes. It should except WP Post object as additional argument → parent_dropdown() breaks because of recent changes. It should except WP Post object as additional argument
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
#23026 would fix the notice introduced in [21735].
Renaming the ticket to better reflect its purpose.