Ticket #19080: 19080.3.diff
File 19080.3.diff, 3.3 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/screen.php
418 418 $id = str_replace( '-user', '', $id ); 419 419 420 420 $id = sanitize_key( $id ); 421 if ( false !== strpos( $id, '-' ) ) { 421 if ( post_type_exists( $id ) ) { 422 $post_type = $id; 423 $id = 'post'; // changes later. ends up being $base. 424 } elseif ( false !== strpos( $id, '-' ) ) { 422 425 list( $id, $second ) = explode( '-', $id, 2 ); 423 426 if ( taxonomy_exists( $second ) ) { 424 427 $id = 'edit-tags'; … … 438 441 439 442 // If this is the current screen, see if we can be more accurate for post types and taxonomies. 440 443 if ( ! $hook_name ) { 444 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) 445 $post_type = $_REQUEST['post_type']; 446 if ( isset( $_REQUEST['taxonomy'] ) && post_type_exists( $_REQUEST['taxonomy'] ) ) 447 $post_type = $_REQUEST['taxonomy']; 448 441 449 switch ( $base ) { 442 450 case 'post' : 443 451 if ( isset( $_GET['post'] ) ) … … 451 459 $post = get_post( $post_id ); 452 460 if ( $post ) 453 461 $post_type = $post->post_type; 454 } elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) ) {455 $post_type = $_POST['post_type'];456 } elseif ( $action == 'add' && isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) {457 $post_type = $_GET['post_type'];458 462 } 459 463 break; 460 case 'edit' :461 if ( isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) )462 $post_type = $_GET['post_type'];463 break;464 464 case 'edit-tags' : 465 if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) 466 $taxonomy = $_REQUEST['taxonomy']; 467 if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) 468 $post_type = $_REQUEST['post_type']; 469 else if ( is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) 465 if ( ! $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) 470 466 $post_type = 'post'; 471 467 break; 472 468 } … … 498 494 $base .= '-user'; 499 495 } 500 496 501 if ( isset( self::$_registry[ $id ] ) ) 502 return self::$_registry[ $id ]; 497 if ( isset( self::$_registry[ $id ] ) ) { 498 $screen = self::$_registry[ $id ]; 499 if ( $screen === get_current_screen() ) 500 return $screen; 501 } else { 502 $screen = new WP_Screen(); 503 $screen->id = $id; 504 } 503 505 504 $screen = new WP_Screen();505 $screen->id = $id;506 506 $screen->base = $base; 507 507 $screen->action = $action; 508 508 $screen->post_type = $post_type; -
wp-admin/admin.php
88 88 $plugin_page = plugin_basename($plugin_page); 89 89 } 90 90 91 if ( isset( $_GET['post_type']) )92 $typenow = sanitize_key($_GET['post_type']);91 if ( isset( $_GET['post_type'] ) && post_type_exists( $_GET['post_type'] ) ) 92 $typenow = $_GET['post_type']; 93 93 else 94 94 $typenow = ''; 95 95 96 if ( isset( $_GET['taxonomy']) )97 $taxnow = sanitize_key($_GET['taxonomy']);96 if ( isset( $_GET['taxonomy'] ) && taxonomy_exists( $_GET['taxonomy'] ) ) 97 $taxnow = $_GET['taxonomy']; 98 98 else 99 99 $taxnow = ''; 100 100