Make WordPress Core


Ignore:
Timestamp:
09/21/2012 10:52:54 PM (12 years ago)
Author:
nacin
Message:

Use the regular post type UI for editing single media items (attachments).

  • Attachments now go through post.php, edit_post(), the like, and have show_ui set to true.
  • Taxonomies attached to the media library now appear in the admin menu (if show_ui).
  • Editing, cropping, uploading, etc. is still very rough, but mostly functional.

API-wise:

  • New function: get_taxonomies_for_attachments(). Like get_taxonomies(), for taxonomies specifically registered against attachments.
  • Brings taxonomy support from the posts list table to the media list table. Expect them to converge soon.
  • wp_insert_attachment() now handles taxonomies like wp_insert_post(). Also expect them to converge soon.
  • New edit_form_after_title hook.

props helenyhou, ocean90. see #21391.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/admin-bar.php

    r21818 r21948  
    488488    $cpts = (array) get_post_types( array( 'show_in_admin_bar' => true ), 'objects' );
    489489
    490     if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->edit_posts ) ) {
     490    if ( isset( $cpts['post'] ) && current_user_can( $cpts['post']->cap->edit_posts ) )
    491491        $actions[ 'post-new.php' ] = array( $cpts['post']->labels->name_admin_bar, 'new-post' );
    492         unset( $cpts['post'] );
    493     }
    494 
    495     if ( current_user_can( 'upload_files' ) )
    496         $actions[ 'media-new.php' ] = array( _x( 'Media', 'add new from admin bar' ), 'new-media' );
     492
     493    if ( isset( $cpts['attachment'] ) && current_user_can( 'upload_files' ) )
     494        $actions[ 'media-new.php' ] = array( $cpts['attachment']->labels->name_admin_bar, 'new-media' );
    497495
    498496    if ( current_user_can( 'manage_links' ) )
    499497        $actions[ 'link-add.php' ] = array( _x( 'Link', 'add new from admin bar' ), 'new-link' );
    500498
    501     if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->edit_posts ) ) {
     499    if ( isset( $cpts['page'] ) && current_user_can( $cpts['page']->cap->edit_posts ) )
    502500        $actions[ 'post-new.php?post_type=page' ] = array( $cpts['page']->labels->name_admin_bar, 'new-page' );
    503         unset( $cpts['page'] );
    504     }
     501
     502    unset( $cpts['post'], $cpts['page'], $cpts['attachment'] );
    505503
    506504    // Add any additional custom post types.
Note: See TracChangeset for help on using the changeset viewer.