diff --git src/wp-includes/class-wp-customize-nav-menus.php src/wp-includes/class-wp-customize-nav-menus.php
index 3d9e60f..7d32cbb 100644
|
|
|
final class WP_Customize_Nav_Menus { |
| 120 | 120 | 'type' => 'post_type', |
| 121 | 121 | 'type_label' => get_post_type_object( $post->post_type )->labels->singular_name, |
| 122 | 122 | 'object' => $post->post_type, |
| 123 | | 'object_id' => (int) $post->ID, |
| | 123 | 'object_id' => intval( $post->ID ), |
| | 124 | 'url' => get_permalink( intval( $post->ID ) ), |
| 124 | 125 | ); |
| 125 | 126 | } |
| 126 | 127 | } elseif ( 'taxonomy' === $obj_type ) { |
| … |
… |
final class WP_Customize_Nav_Menus { |
| 147 | 148 | 'type' => 'taxonomy', |
| 148 | 149 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
| 149 | 150 | 'object' => $term->taxonomy, |
| 150 | | 'object_id' => $term->term_id, |
| | 151 | 'object_id' => intval( $term->term_id ), |
| | 152 | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 151 | 153 | ); |
| 152 | 154 | } |
| 153 | 155 | } |
| … |
… |
final class WP_Customize_Nav_Menus { |
| 228 | 230 | } |
| 229 | 231 | $results[] = array( |
| 230 | 232 | 'id' => 'post-' . $post->ID, |
| | 233 | 'title' => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ), |
| 231 | 234 | 'type' => 'post_type', |
| 232 | 235 | 'type_label' => $post_type_objects[ $post->post_type ]->labels->singular_name, |
| 233 | 236 | 'object' => $post->post_type, |
| 234 | 237 | 'object_id' => intval( $post->ID ), |
| 235 | | 'title' => html_entity_decode( $post_title, ENT_QUOTES, get_bloginfo( 'charset' ) ), |
| | 238 | 'url' => get_permalink( intval( $post->ID ) ), |
| 236 | 239 | ); |
| 237 | 240 | } |
| 238 | 241 | } |
| … |
… |
final class WP_Customize_Nav_Menus { |
| 250 | 253 | foreach ( $terms as $term ) { |
| 251 | 254 | $results[] = array( |
| 252 | 255 | 'id' => 'term-' . $term->term_id, |
| | 256 | 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ), |
| 253 | 257 | 'type' => 'taxonomy', |
| 254 | 258 | 'type_label' => get_taxonomy( $term->taxonomy )->labels->singular_name, |
| 255 | 259 | 'object' => $term->taxonomy, |
| 256 | 260 | 'object_id' => intval( $term->term_id ), |
| 257 | | 'title' => html_entity_decode( $term->name, ENT_QUOTES, get_bloginfo( 'charset' ) ), |
| | 261 | 'url' => get_term_link( intval( $term->term_id ), $term->taxonomy ), |
| 258 | 262 | ); |
| 259 | 263 | } |
| 260 | 264 | } |
diff --git tests/phpunit/tests/customize/nav-menus.php tests/phpunit/tests/customize/nav-menus.php
index 0cb6fe6..7c0ee3d 100644
|
|
|
class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase { |
| 97 | 97 | foreach ( $post_ids as $post_id ) { |
| 98 | 98 | $expected = array( |
| 99 | 99 | 'id' => 'post-' . $post_id, |
| | 100 | 'title' => html_entity_decode( get_the_title( $post_id ) ), |
| 100 | 101 | 'type' => 'post_type', |
| 101 | 102 | 'type_label' => get_post_type_object( 'post' )->labels->singular_name, |
| 102 | 103 | 'object' => 'post', |
| 103 | 104 | 'object_id' => intval( $post_id ), |
| 104 | | 'title' => html_entity_decode( get_the_title( $post_id ) ), |
| | 105 | 'url' => get_permalink( intval( $post_id ) ), |
| 105 | 106 | ); |
| 106 | 107 | wp_set_object_terms( $post_id, $term_ids, 'category' ); |
| 107 | 108 | $search = $post_id === $post_ids[0] ? 'test & search' : 'other title'; |
| … |
… |
class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase { |
| 115 | 116 | $term = get_term_by( 'id', $term_id, 'category' ); |
| 116 | 117 | $expected = array( |
| 117 | 118 | 'id' => 'term-' . $term_id, |
| | 119 | 'title' => $term->name, |
| 118 | 120 | 'type' => 'taxonomy', |
| 119 | 121 | 'type_label' => get_taxonomy( 'category' )->labels->singular_name, |
| 120 | 122 | 'object' => 'category', |
| 121 | 123 | 'object_id' => intval( $term_id ), |
| 122 | | 'title' => $term->name, |
| | 124 | 'url' => get_term_link( intval( $term_id ), 'category' ), |
| 123 | 125 | ); |
| 124 | 126 | $s = sanitize_text_field( wp_unslash( $term->name ) ); |
| 125 | 127 | $results = $menus->search_available_items_query( array( 'pagenum' => 1, 's' => $s ) ); |