Changeset 60775
- Timestamp:
- 09/17/2025 05:46:39 AM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-admin/includes/nav-menu.php (modified) (1 diff)
-
tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/nav-menu.php
r60180 r60775 81 81 } 82 82 } 83 } elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z _-]*\b)/', $type, $matches ) ) {83 } elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z0-9_-]*\b)/', $type, $matches ) ) { 84 84 if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) { 85 85 $post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) ); -
trunk/tests/phpunit/tests/menu/wpAjaxMenuQuickSearch.php
r57987 r60775 122 122 $this->assertCount( 1, $results ); 123 123 } 124 125 /** 126 * Test that search displays results for post types with numeric slugs 127 * 128 * @ticket 63633 129 */ 130 public function test_search_returns_post_types_with_numeric_slugs() { 131 register_post_type( 'wptests_123' ); 132 133 self::factory()->post->create( 134 array( 135 'post_title' => 'Post Title 123', 136 'post_type' => 'wptests_123', 137 'post_status' => 'publish', 138 'post_content' => 'FOO', 139 ) 140 ); 141 142 $request = array( 143 'type' => 'quick-search-posttype-wptests_123', 144 'q' => 'FOO', 145 ); 146 147 $output = get_echo( '_wp_ajax_menu_quick_search', array( $request ) ); 148 $this->assertNotEmpty( $output ); 149 150 $results = explode( "\n", trim( $output ) ); 151 $this->assertCount( 1, $results ); 152 153 $results_json = array_map( 'json_decode', $results ); 154 $this->assertEquals( 'wptests_123', $results_json[0]->post_type ); 155 } 124 156 }
Note: See TracChangeset
for help on using the changeset viewer.