From ecc4106ed195fa199b7a9ee9144fbdb07e824112 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 14 Sep 2015 03:20:25 +0000 Subject: [PATCH] Add an argument to `parent_dropdown()`, `$post`, to allow it to be called for an arbitrary post. Fixes #23162. Built from https://develop.svn.wordpress.org/trunk@34111 git-svn-id: http://core.svn.wordpress.org/trunk@34079 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 14 ++++++++------ wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 6f0e7bc9ab..ef015390a3 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -767,7 +767,7 @@ function meta_form( $post = null ) { function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { global $wp_locale; $post = get_post(); - + if ( $for_post ) $edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ); @@ -860,18 +860,20 @@ function page_template_dropdown( $default = '' ) { * Print out option HTML elements for the page parents drop-down. * * @since 1.5.0 + * @since 4.4.0 `$post` argument was added. * * @global wpdb $wpdb * - * @param int $default Optional. The default page ID to be pre-selected. Default 0. - * @param int $parent Optional. The parent page ID. Default 0. - * @param int $level Optional. Page depth level. Default 0. + * @param int $default Optional. The default page ID to be pre-selected. Default 0. + * @param int $parent Optional. The parent page ID. Default 0. + * @param int $level Optional. Page depth level. Default 0. + * @param int|WP_Post $post Post ID or WP_Post object. * * @return null|false Boolean False if page has no children, otherwise print out html elements */ -function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) { +function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { global $wpdb; - $post = get_post(); + $post = get_post( $post ); $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) ); if ( $items ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 8439f86c65..cec29d5959 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34110'; +$wp_version = '4.4-alpha-34111'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.