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.



git-svn-id: https://develop.svn.wordpress.org/trunk@21948 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-09-21 22:52:54 +00:00
parent c33b88351b
commit 991be145a9
15 changed files with 350 additions and 65 deletions

View File

@@ -106,7 +106,7 @@ function get_permalink( $id = 0, $leavename = false ) {
if ( $post->post_type == 'page' )
return get_page_link($post->ID, $leavename, $sample);
elseif ( $post->post_type == 'attachment' )
return get_attachment_link($post->ID);
return get_attachment_link( $post->ID, $leavename );
elseif ( in_array($post->post_type, get_post_types( array('_builtin' => false) ) ) )
return get_post_permalink($post->ID, $leavename, $sample);
@@ -292,9 +292,10 @@ function _get_page_link( $post = false, $leavename = false, $sample = false ) {
* @since 2.0.0
*
* @param mixed $post Optional. Post ID or object.
* @param bool $leavename Optional. Leave name.
* @return string
*/
function get_attachment_link( $post = null ) {
function get_attachment_link( $post = null, $leavename = false ) {
global $wp_rewrite;
$link = false;
@@ -314,7 +315,10 @@ function get_attachment_link( $post = null ) {
$name = $post->post_name;
if ( strpos($parentlink, '?') === false )
$link = user_trailingslashit( trailingslashit($parentlink) . $name );
$link = user_trailingslashit( trailingslashit($parentlink) . '%postname%' );
if ( ! $leavename )
$link = str_replace( '%postname%', $name, $link );
}
if ( ! $link )