#23162 closed enhancement (fixed)
Allow to call parent_dropdown() for an arbitrary post
Reported by: | charliespider | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 1.5 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | administration | Cc: |
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
@
12 years ago
- Summary changed from parent_dropdown() should except WP Post object as additional argument to parent_dropdown() breaks becuause of recent changes. It should except WP Post object as additional argument
#2
@
12 years ago
- Summary changed from parent_dropdown() breaks becuause of recent changes. It should except WP Post object as additional argument to parent_dropdown() breaks because of recent changes. It should except WP Post object as additional argument
#3
@
12 years ago
- Component changed from Warnings/Notices to Administration
- Summary changed from parent_dropdown() breaks because of recent changes. It should except WP Post object as additional argument to Allow to call parent_dropdown() for an arbitrary post
#4
@
11 years ago
- Component changed from Administration to Posts, Post Types
- Focuses administration added
#5
@
9 years ago
- Keywords has-patch added
- Milestone changed from Awaiting Review to 4.4
- Version set to 1.5
Note: See
TracTickets for help on using
tickets.
#23026 would fix the notice introduced in [21735].
Renaming the ticket to better reflect its purpose.