diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php index d3b09ce5df..c5bc72c85e 100644 --- a/src/wp-admin/includes/nav-menu.php +++ b/src/wp-admin/includes/nav-menu.php @@ -325,7 +325,7 @@ function wp_nav_menu_item_link_meta_box() { * @global int $_nav_menu_placeholder * @global int|string $nav_menu_selected_id * - * @param string $item_object Not used. + * @param string $data_object Not used. * @param array $box { * Post type menu item meta box arguments. * @@ -335,7 +335,7 @@ function wp_nav_menu_item_link_meta_box() { * @type WP_Post_Type $args Extra meta box arguments (the post type object for this meta box). * } */ -function wp_nav_menu_item_post_type_meta_box( $item_object, $box ) { +function wp_nav_menu_item_post_type_meta_box( $data_object, $box ) { global $_nav_menu_placeholder, $nav_menu_selected_id; $post_type_name = $box['args']->name; @@ -689,7 +689,7 @@ function wp_nav_menu_item_post_type_meta_box( $item_object, $box ) { * * @global int|string $nav_menu_selected_id * - * @param string $item_object Not used. + * @param string $data_object Not used. * @param array $box { * Taxonomy menu item meta box arguments. * @@ -699,7 +699,7 @@ function wp_nav_menu_item_post_type_meta_box( $item_object, $box ) { * @type object $args Extra meta box arguments (the taxonomy object for this meta box). * } */ -function wp_nav_menu_item_taxonomy_meta_box( $item_object, $box ) { +function wp_nav_menu_item_taxonomy_meta_box( $data_object, $box ) { global $nav_menu_selected_id; $taxonomy_name = $box['args']->name; @@ -989,40 +989,40 @@ function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) { * * @access private * - * @param object $item_object The post type or taxonomy meta-object. + * @param object $data_object The post type or taxonomy meta-object. * @return object The post type or taxonomy object. */ function _wp_nav_menu_meta_box_object( $item_object = null ) { - if ( isset( $item_object->name ) ) { + if ( isset( $data_object->name ) ) { - if ( 'page' === $item_object->name ) { - $item_object->_default_query = array( + if ( 'page' === $data_object->name ) { + $data_object->_default_query = array( 'orderby' => 'menu_order title', 'post_status' => 'publish', ); // Posts should show only published items. - } elseif ( 'post' === $item_object->name ) { - $item_object->_default_query = array( + } elseif ( 'post' === $data_object->name ) { + $data_object->_default_query = array( 'post_status' => 'publish', ); // Categories should be in reverse chronological order. - } elseif ( 'category' === $item_object->name ) { - $item_object->_default_query = array( + } elseif ( 'category' === $data_object->name ) { + $data_object->_default_query = array( 'orderby' => 'id', 'order' => 'DESC', ); // Custom post types should show only published items. } else { - $item_object->_default_query = array( + $data_object->_default_query = array( 'post_status' => 'publish', ); } } - return $item_object; + return $data_object; } /** diff --git a/src/wp-admin/includes/template.php b/src/wp-admin/includes/template.php index 5d1763f6c1..392595b555 100644 --- a/src/wp-admin/includes/template.php +++ b/src/wp-admin/includes/template.php @@ -193,20 +193,20 @@ function wp_terms_checklist( $post_id = 0, $args = array() ) { /** * Retrieves a list of the most popular terms from the specified taxonomy. * - * If the $echo argument is true then the elements for a list of checkbox + * If the `$display` argument is true then the elements for a list of checkbox * `` elements labelled with the names of the selected terms is output. - * If the $post_ID global is not empty then the terms associated with that + * If the `$post_ID` global is not empty then the terms associated with that * post will be marked as checked. * * @since 2.5.0 * - * @param string $taxonomy Taxonomy to retrieve terms from. - * @param int $default Not used. - * @param int $number Number of terms to retrieve. Defaults to 10. - * @param bool $echo Optionally output the list as well. Defaults to true. + * @param string $taxonomy Taxonomy to retrieve terms from. + * @param int $default_term Optional. Not used. + * @param int $number Optional. Number of terms to retrieve. Default 10. + * @param bool $display Optional. Whether to display the list as well. Default true. * @return int[] Array of popular term IDs. */ -function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) { +function wp_popular_terms_checklist( $taxonomy, $default_term = 0, $number = 10, $display = true ) { $post = get_post(); if ( $post && $post->ID ) { @@ -231,9 +231,11 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech foreach ( (array) $terms as $term ) { $popular_ids[] = $term->term_id; - if ( ! $echo ) { // Hack for Ajax use. + + if ( ! $display ) { // Hack for Ajax use. continue; } + $id = "popular-$taxonomy-$term->term_id"; $checked = in_array( $term->term_id, $checked_terms, true ) ? 'checked="checked"' : ''; ?> @@ -874,16 +876,16 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { * @since 1.5.0 * @since 4.7.0 Added the `$post_type` parameter. * - * @param string $default Optional. The template file name. Default empty. - * @param string $post_type Optional. Post type to get templates for. Default 'post'. + * @param string $default_template Optional. The template file name. Default empty. + * @param string $post_type Optional. Post type to get templates for. Default 'post'. */ -function page_template_dropdown( $default = '', $post_type = 'page' ) { +function page_template_dropdown( $default_template = '', $post_type = 'page' ) { $templates = get_page_templates( null, $post_type ); ksort( $templates ); foreach ( array_keys( $templates ) as $template ) { - $selected = selected( $default, $templates[ $template ], false ); + $selected = selected( $default_template, $templates[ $template ], false ); echo "\n\t'; } } @@ -896,13 +898,13 @@ function page_template_dropdown( $default = '', $post_type = 'page' ) { * * @global wpdb $wpdb WordPress database abstraction object. * - * @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. + * @param int $default_page 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 void|false Void on success, false if the page has no children. */ -function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) { +function parent_dropdown( $default_page = 0, $parent = 0, $level = 0, $post = null ) { global $wpdb; $post = get_post( $post ); @@ -916,10 +918,10 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) } $pad = str_repeat( ' ', $level * 3 ); - $selected = selected( $default, $item->ID, false ); + $selected = selected( $default_page, $item->ID, false ); echo "\n\t'; - parent_dropdown( $default, $item->ID, $level + 1 ); + parent_dropdown( $default_page, $item->ID, $level + 1 ); } } else { return false; @@ -1128,8 +1130,8 @@ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan * * @since 5.0.0 * - * @param mixed $object The data object being rendered on this screen. - * @param array $box { + * @param mixed $data_object The data object being rendered on this screen. + * @param array $box { * Custom formats meta box arguments. * * @type string $id Meta box 'id' attribute. @@ -1138,7 +1140,7 @@ function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advan * @type array $args Extra meta box arguments. * } */ -function do_block_editor_incompatible_meta_box( $object, $box ) { +function do_block_editor_incompatible_meta_box( $data_object, $box ) { $plugin = _get_plugin_from_callback( $box['old_callback'] ); $plugins = get_plugins(); echo '
'; @@ -1174,13 +1176,13 @@ function do_block_editor_incompatible_meta_box( $object, $box ) { printf( __( 'Please activate the Classic Editor plugin to use this meta box.' ), esc_url( $activate_url ) ); echo '
'; } - } elseif ( $object instanceof WP_Post ) { + } elseif ( $data_object instanceof WP_Post ) { $edit_url = add_query_arg( array( 'classic-editor' => '', 'classic-editor__forget' => '', ), - get_edit_post_link( $object ) + get_edit_post_link( $data_object ) ); echo ''; /* translators: %s: A link to use the Classic Editor plugin. */ @@ -1244,17 +1246,17 @@ function _get_plugin_from_callback( $callback ) { * * @global array $wp_meta_boxes * - * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or - * add_submenu_page() to create a new screen (and hence screen_id) - * make sure your menu slug conforms to the limits of sanitize_key() - * otherwise the 'screen' menu may not correctly render on your page. - * @param string $context The screen context for which to display meta boxes. - * @param mixed $object Gets passed to the meta box callback function as the first parameter. - * Often this is the object that's the focus of the current screen, for - * example a `WP_Post` or `WP_Comment` object. + * @param string|WP_Screen $screen The screen identifier. If you have used add_menu_page() or + * add_submenu_page() to create a new screen (and hence screen_id) + * make sure your menu slug conforms to the limits of sanitize_key() + * otherwise the 'screen' menu may not correctly render on your page. + * @param string $context The screen context for which to display meta boxes. + * @param mixed $data_object Gets passed to the meta box callback function as the first parameter. + * Often this is the object that's the focus of the current screen, + * for example a `WP_Post` or `WP_Comment` object. * @return int Number of meta_boxes. */ -function do_meta_boxes( $screen, $context, $object ) { +function do_meta_boxes( $screen, $context, $data_object ) { global $wp_meta_boxes; static $already_sorted = false; @@ -1396,7 +1398,7 @@ function do_meta_boxes( $screen, $context, $object ) { } } - call_user_func( $box['callback'], $object, $box ); + call_user_func( $box['callback'], $data_object, $box ); echo "\n"; echo "\n"; } @@ -1473,12 +1475,12 @@ function remove_meta_box( $id, $screen, $context ) { * * @uses global $wp_meta_boxes Used to retrieve registered meta boxes. * - * @param string|object $screen The screen identifier. - * @param string $context The screen context for which to display accordion sections. - * @param mixed $object Gets passed to the section callback function as the first parameter. + * @param string|object $screen The screen identifier. + * @param string $context The screen context for which to display accordion sections. + * @param mixed $data_object Gets passed to the section callback function as the first parameter. * @return int Number of meta boxes as accordion sections. */ -function do_accordion_sections( $screen, $context, $object ) { +function do_accordion_sections( $screen, $context, $data_object ) { global $wp_meta_boxes; wp_enqueue_script( 'accordion' ); @@ -1523,7 +1525,7 @@ function do_accordion_sections( $screen, $context, $object ) {