WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/21/2012 10:52:54 PM (8 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-admin/post.php

    r21651 r21948  
    8686     strpos( $sendback, 'post.php' ) !== false ||
    8787     strpos( $sendback, 'post-new.php' ) !== false ) {
    88     $sendback = admin_url( 'edit.php' );
    89     $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
     88    if ( 'attachment' == $post_type ) {
     89        $sendback = admin_url( 'upload.php' );
     90    } else {
     91        $sendback = admin_url( 'edit.php' );
     92        $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
     93    }
    9094} else {
    9195    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
     
    149153        $submenu_file = "edit.php";
    150154        $post_new_file = "post-new.php";
     155    } elseif ( 'attachment' == $post_type ) {
     156        $parent_file = 'upload.php';
     157        $submenu_file = 'upload.php';
     158        $post_new_file = 'media-new.php';
    151159    } else {
    152160        if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
Note: See TracChangeset for help on using the changeset viewer.