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-admin/includes/post.php

    r21944 r21948  
    233233                continue;
    234234            delete_meta( $key );
     235        }
     236    }
     237
     238    // Attachment stuff
     239    if ( 'attachment' == $post_data['post_type'] && isset( $post_data['_wp_attachment_image_alt'] ) ) {
     240        $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true );
     241        if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
     242            $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
     243            // update_meta expects slashed
     244            update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
    235245        }
    236246    }
     
    10651075    list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);
    10661076
    1067     if ( 'publish' == $post->post_status ) {
     1077    if ( 'publish' == get_post_status( $post ) ) {
    10681078        $ptype = get_post_type_object($post->post_type);
    10691079        $view_post = $ptype->labels->view_item;
Note: See TracChangeset for help on using the changeset viewer.