Changeset 21948 for trunk/wp-includes/post.php
- Timestamp:
- 09/21/2012 10:52:54 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/post.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r21943 r21948 53 53 register_post_type( 'attachment', array( 54 54 'labels' => array( 55 'name' => __( 'Media' ), 56 'edit_item' => __( 'Edit Media' ), 55 'name' => _x('Media', 'post type general name'), 56 'name_admin_bar' => _x( 'Media', 'add new from admin bar' ), 57 'add_new' => _x( 'Add New', 'add new media' ), 58 'edit_item' => __( 'Edit Media' ), 59 'view_item' => __( 'View Attachment Page' ), 57 60 ), 58 61 'public' => true, 59 'show_ui' => false,62 'show_ui' => true, 60 63 '_builtin' => true, /* internal use only. don't use this when registering your own post type. */ 61 '_edit_link' => ' media.php?attachment_id=%d', /* internal use only. don't use this when registering your own post type. */64 '_edit_link' => 'post.php?post=%d', /* internal use only. don't use this when registering your own post type. */ 62 65 'capability_type' => 'post', 63 66 'map_meta_cap' => true, … … 67 70 'show_in_nav_menus' => false, 68 71 'delete_with_user' => true, 69 'supports' => array( ' comments', 'author' ),72 'supports' => array( 'title', 'author', 'comments' ), 70 73 ) ); 71 74 … … 3769 3772 $post_status = 'inherit'; 3770 3773 3774 if ( !empty($post_category) ) 3775 $post_category = array_filter($post_category); // Filter out empty terms 3776 3771 3777 // Make sure we set a valid category. 3772 if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category) ) { 3773 // 'post' requires at least one category. 3774 if ( 'post' == $post_type ) 3775 $post_category = array( get_option('default_category') ); 3776 else 3777 $post_category = array(); 3778 if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { 3779 $post_category = array(); 3778 3780 } 3779 3781 … … 3860 3862 } 3861 3863 3862 wp_set_post_categories($post_ID, $post_category); 3864 if ( is_object_in_taxonomy($post_type, 'category') ) 3865 wp_set_post_categories( $post_ID, $post_category ); 3866 3867 if ( isset( $tags_input ) && is_object_in_taxonomy($post_type, 'post_tag') ) 3868 wp_set_post_tags( $post_ID, $tags_input ); 3869 3870 // support for all custom taxonomies 3871 if ( !empty($tax_input) ) { 3872 foreach ( $tax_input as $taxonomy => $tags ) { 3873 $taxonomy_obj = get_taxonomy($taxonomy); 3874 if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical. 3875 $tags = array_filter($tags); 3876 if ( current_user_can($taxonomy_obj->cap->assign_terms) ) 3877 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 3878 } 3879 } 3863 3880 3864 3881 if ( $file )
Note: See TracChangeset
for help on using the changeset viewer.