diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
index adccacd..6f5944f 100644
|
|
final class WP_Customize_Nav_Menus { |
109 | 109 | if ( 'post_type' === $type ) { |
110 | 110 | if ( ! get_post_type_object( $object ) ) { |
111 | 111 | return new WP_Error( 'nav_menus_invalid_post_type' ); |
| 112 | } else { |
| 113 | $post_type = get_post_type_object( $object ); |
112 | 114 | } |
113 | 115 | |
114 | 116 | if ( 0 === $page && 'page' === $object ) { |
… |
… |
final class WP_Customize_Nav_Menus { |
121 | 123 | 'object' => '', |
122 | 124 | 'url' => home_url(), |
123 | 125 | ); |
| 126 | } elseif ( 'post' !== $object && 0 === $page && $post_type->has_archive ) { |
| 127 | // Add a post type archive link. |
| 128 | $items[] = array( |
| 129 | 'id' => $object . '-archive', |
| 130 | 'title' => $post_type->labels->archives, |
| 131 | 'type' => 'post_type_archive', |
| 132 | 'type_label' => __( 'Post Type Archive' ), |
| 133 | 'object' => $object, |
| 134 | 'url' => get_post_type_archive_link( $object ), |
| 135 | ); |
124 | 136 | } |
125 | 137 | |
126 | 138 | $posts = get_posts( array( |
diff --git src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php src/wp-includes/customize/class-wp-customize-nav-menu-item-setting.php
index f8aaec7..463da87 100644
|
|
class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { |
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
| 327 | if ( ! isset( $this->value['title'] ) ) { |
| 328 | $this->value['title'] = ''; |
| 329 | } |
| 330 | |
327 | 331 | if ( ! isset( $this->value['_invalid'] ) ) { |
328 | | $this->value['_invalid'] = ( |
329 | | ( 'post_type' === $this->value['type'] && ! post_type_exists( $this->value['object'] ) ) |
| 332 | $this->value['_invalid'] = false; |
| 333 | $is_known_invalid = ( |
| 334 | ( ( 'post_type' === $this->value['type'] || 'post_type_archive' === $this->value['type'] ) && ! post_type_exists( $this->value['object'] ) ) |
330 | 335 | || |
331 | 336 | ( 'taxonomy' === $this->value['type'] && ! taxonomy_exists( $this->value['object'] ) ) |
332 | 337 | ); |
| 338 | if ( $is_known_invalid ) { |
| 339 | $this->value['_invalid'] = true; |
| 340 | } |
333 | 341 | } |
334 | 342 | |
335 | 343 | // Remove remaining properties available on a setup nav_menu_item post object which aren't relevant to the setting value. |