WordPress.org

Make WordPress Core

Changeset 40800


Ignore:
Timestamp:
05/19/17 18:28:58 (6 months ago)
Author:
joemcgill
Message:

Media: Ensure WP_Screen sets post type on wp-admin/upload.php.

The post type property is set to 'attachment' when on the upload screen.

Props postpostmodern.
Fixes #39509.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r40308 r40800  
    308308                    if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) 
    309309                        $post_type = 'post'; 
     310                    break; 
     311                case 'upload': 
     312                    $post_type = 'attachment'; 
    310313                    break; 
    311314            } 
  • trunk/tests/phpunit/tests/admin/includesScreen.php

    r38763 r40800  
    1313        'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ), 
    1414        'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ), 
    15         'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ), 
     15        'upload.php' => array( 'base' => 'upload', 'id' => 'upload', 'post_type' => 'attachment' ), 
    1616        'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ), 
    1717        'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ), 
Note: See TracChangeset for help on using the changeset viewer.