Changeset 53245
- Timestamp:
- 04/23/2022 08:57:06 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-nav-menus.php
r53055 r53245 132 132 * @since 4.3.0 133 133 * 134 * @param string $ typeOptional. Accepts any custom object type and has built-in support for135 * 'post_type' and 'taxonomy'. Default is 'post_type'.136 * @param string $object Optional. Accepts any registered taxonomy or post type name. Default is 'page'.137 * @param int $page Optional. The page number used to generate the query offset. Default is '0'.134 * @param string $object_type Optional. Accepts any custom object type and has built-in support for 135 * 'post_type' and 'taxonomy'. Default is 'post_type'. 136 * @param string $object_name Optional. Accepts any registered taxonomy or post type name. Default is 'page'. 137 * @param int $page Optional. The page number used to generate the query offset. Default is '0'. 138 138 * @return array|WP_Error An array of menu items on success, a WP_Error object on failure. 139 139 */ 140 public function load_available_items_query( $ type = 'post_type', $object= 'page', $page = 0 ) {140 public function load_available_items_query( $object_type = 'post_type', $object_name = 'page', $page = 0 ) { 141 141 $items = array(); 142 142 143 if ( 'post_type' === $ type ) {144 $post_type = get_post_type_object( $object );143 if ( 'post_type' === $object_type ) { 144 $post_type = get_post_type_object( $object_name ); 145 145 if ( ! $post_type ) { 146 146 return new WP_Error( 'nav_menus_invalid_post_type' ); … … 153 153 $important_pages = array(); 154 154 $suppress_page_ids = array(); 155 if ( 0 === $page && 'page' === $object ) {155 if ( 0 === $page && 'page' === $object_name ) { 156 156 // Insert Front Page or custom "Home" link. 157 157 $front_page = 'page' === get_option( 'show_on_front' ) ? (int) get_option( 'page_on_front' ) : 0; … … 189 189 } 190 190 } 191 } elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) {191 } elseif ( 'post' !== $object_name && 0 === $page && $post_type->has_archive ) { 192 192 // Add a post type archive link. 193 193 $items[] = array( 194 'id' => $object . '-archive',194 'id' => $object_name . '-archive', 195 195 'title' => $post_type->labels->archives, 196 196 'type' => 'post_type_archive', 197 197 'type_label' => __( 'Post Type Archive' ), 198 'object' => $object ,199 'url' => get_post_type_archive_link( $object ),198 'object' => $object_name, 199 'url' => get_post_type_archive_link( $object_name ), 200 200 ); 201 201 } … … 217 217 'orderby' => 'date', 218 218 'order' => 'DESC', 219 'post_type' => $object ,219 'post_type' => $object_name, 220 220 ); 221 221 … … 254 254 ); 255 255 } 256 } elseif ( 'taxonomy' === $ type ) {256 } elseif ( 'taxonomy' === $object_type ) { 257 257 $terms = get_terms( 258 258 array( 259 'taxonomy' => $object ,259 'taxonomy' => $object_name, 260 260 'child_of' => 0, 261 261 'exclude' => '', … … 293 293 * @since 4.3.0 294 294 * 295 * @param array $items The array of menu items.296 * @param string $ typeThe object type.297 * @param string $object The object name.295 * @param array $items The array of menu items. 296 * @param string $object_type The object type. 297 * @param string $object_name The object name. 298 298 * @param int $page The current page number. 299 299 */ 300 $items = apply_filters( 'customize_nav_menu_available_items', $items, $ type, $object, $page );300 $items = apply_filters( 'customize_nav_menu_available_items', $items, $object_type, $object_name, $page ); 301 301 302 302 return $items;
Note: See TracChangeset
for help on using the changeset viewer.