WordPress.org

Make WordPress Core

Changeset 34111


Ignore:
Timestamp:
09/14/2015 03:19:59 AM (6 years ago)
Author:
wonderboymusic
Message:

Add an argument to parent_dropdown(), $post, to allow it to be called for an arbitrary post.

Fixes #23162.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template.php

    r34094 r34111  
    768768    global $wp_locale;
    769769    $post = get_post();
    770    
     770
    771771    if ( $for_post )
    772772        $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
     
    861861 *
    862862 * @since 1.5.0
     863 * @since 4.4.0 `$post` argument was added.
    863864 *
    864865 * @global wpdb $wpdb
    865866 *
    866  * @param int $default Optional. The default page ID to be pre-selected. Default 0.
    867  * @param int $parent  Optional. The parent page ID. Default 0.
    868  * @param int $level   Optional. Page depth level. Default 0.
     867 * @param int         $default Optional. The default page ID to be pre-selected. Default 0.
     868 * @param int         $parent  Optional. The parent page ID. Default 0.
     869 * @param int         $level   Optional. Page depth level. Default 0.
     870 * @param int|WP_Post $post    Post ID or WP_Post object.
    869871 *
    870872 * @return null|false Boolean False if page has no children, otherwise print out html elements
    871873 */
    872 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
     874function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {
    873875    global $wpdb;
    874     $post = get_post();
     876    $post = get_post( $post );
    875877    $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
    876878
Note: See TracChangeset for help on using the changeset viewer.