| 1 | Index: wp-includes/post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/post.php (revision 13615) |
|---|
| 4 | +++ wp-includes/post.php (working copy) |
|---|
| 5 | @@ -15,63 +15,10 @@ |
|---|
| 6 | * Creates the initial post types when 'init' action is fired. |
|---|
| 7 | */ |
|---|
| 8 | function create_initial_post_types() { |
|---|
| 9 | - register_post_type( 'post', array( 'label' => __('Posts'), |
|---|
| 10 | - 'singular_label' => __('Post'), |
|---|
| 11 | - 'public' => true, |
|---|
| 12 | - 'show_ui' => false, |
|---|
| 13 | - '_builtin' => true, |
|---|
| 14 | - '_edit_link' => 'post.php?post=%d', |
|---|
| 15 | - 'capability_type' => 'post', |
|---|
| 16 | - 'hierarchical' => false, |
|---|
| 17 | - 'rewrite' => false, |
|---|
| 18 | - 'query_var' => false, |
|---|
| 19 | - 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') |
|---|
| 20 | - ) ); |
|---|
| 21 | + $initial_post_types = apply_filters('initial_post_types',default_initial_post_types()); |
|---|
| 22 | + foreach($initial_post_types as $post_type => $attributes) |
|---|
| 23 | + register_post_type($post_type,$attributes); |
|---|
| 24 | |
|---|
| 25 | - register_post_type( 'page', array( 'label' => __('Pages'), |
|---|
| 26 | - 'singular_label' => __('Page'), |
|---|
| 27 | - 'public' => true, |
|---|
| 28 | - 'show_ui' => false, |
|---|
| 29 | - '_builtin' => true, |
|---|
| 30 | - '_edit_link' => 'post.php?post=%d', |
|---|
| 31 | - 'capability_type' => 'page', |
|---|
| 32 | - 'hierarchical' => true, |
|---|
| 33 | - 'rewrite' => false, |
|---|
| 34 | - 'query_var' => false, |
|---|
| 35 | - 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') |
|---|
| 36 | - ) ); |
|---|
| 37 | - |
|---|
| 38 | - register_post_type( 'attachment', array('label' => __('Media'), |
|---|
| 39 | - 'public' => true, |
|---|
| 40 | - 'show_ui' => false, |
|---|
| 41 | - '_builtin' => true, |
|---|
| 42 | - '_edit_link' => 'media.php?attachment_id=%d', |
|---|
| 43 | - 'capability_type' => 'post', |
|---|
| 44 | - 'hierarchical' => false, |
|---|
| 45 | - 'rewrite' => false, |
|---|
| 46 | - 'query_var' => false, |
|---|
| 47 | - ) ); |
|---|
| 48 | - |
|---|
| 49 | - register_post_type( 'revision', array( 'label' => __('Revisions'), |
|---|
| 50 | - 'singular_label' => __('Revision'), |
|---|
| 51 | - 'public' => false, |
|---|
| 52 | - '_builtin' => true, |
|---|
| 53 | - '_edit_link' => 'revision.php?revision=%d', |
|---|
| 54 | - 'capability_type' => 'post', |
|---|
| 55 | - 'hierarchical' => false, |
|---|
| 56 | - 'rewrite' => false, |
|---|
| 57 | - 'query_var' => false, |
|---|
| 58 | - ) ); |
|---|
| 59 | - |
|---|
| 60 | - register_post_type( 'nav_menu_item', array( 'public' => false, |
|---|
| 61 | - 'show_ui' => false, |
|---|
| 62 | - '_builtin' => true, |
|---|
| 63 | - 'capability_type' => 'post', |
|---|
| 64 | - 'hierarchical' => false, |
|---|
| 65 | - 'rewrite' => false, |
|---|
| 66 | - 'query_var' => false, |
|---|
| 67 | - ) ); |
|---|
| 68 | - |
|---|
| 69 | register_post_status( 'publish', array( 'label' => _x('Published', 'post'), |
|---|
| 70 | 'public' => true, |
|---|
| 71 | '_builtin' => true, |
|---|
| 72 | @@ -117,6 +64,64 @@ |
|---|
| 73 | } |
|---|
| 74 | add_action( 'init', 'create_initial_post_types', 0 ); // highest priority |
|---|
| 75 | |
|---|
| 76 | +function default_initial_post_types() { |
|---|
| 77 | + $initial_post_types = array( |
|---|
| 78 | + 'post' => array('label' => __('Posts'), |
|---|
| 79 | + 'singular_label' => __('Post'), |
|---|
| 80 | + 'public' => true, |
|---|
| 81 | + 'show_ui' => false, |
|---|
| 82 | + '_builtin' => true, |
|---|
| 83 | + '_edit_link' => 'post.php?post=%d', |
|---|
| 84 | + 'capability_type' => 'post', |
|---|
| 85 | + 'hierarchical' => false, |
|---|
| 86 | + 'rewrite' => false, |
|---|
| 87 | + 'query_var' => false, |
|---|
| 88 | + 'supports' => array('post-thumbnails', 'excerpts', 'trackbacks', 'custom-fields', 'comments', 'revisions') |
|---|
| 89 | + ), |
|---|
| 90 | + 'page' => array( 'label' => __('Pages'), |
|---|
| 91 | + 'singular_label' => __('Page'), |
|---|
| 92 | + 'public' => true, |
|---|
| 93 | + 'show_ui' => false, |
|---|
| 94 | + '_builtin' => true, |
|---|
| 95 | + '_edit_link' => 'post.php?post=%d', |
|---|
| 96 | + 'capability_type' => 'page', |
|---|
| 97 | + 'hierarchical' => true, |
|---|
| 98 | + 'rewrite' => false, |
|---|
| 99 | + 'query_var' => false, |
|---|
| 100 | + 'supports' => array('post-thumbnails', 'page-attributes', 'custom-fields', 'comments', 'revisions') |
|---|
| 101 | + ), |
|---|
| 102 | + 'attachment' => array('label' => __('Media'), |
|---|
| 103 | + 'public' => true, |
|---|
| 104 | + 'show_ui' => false, |
|---|
| 105 | + '_builtin' => true, |
|---|
| 106 | + '_edit_link' => 'media.php?attachment_id=%d', |
|---|
| 107 | + 'capability_type' => 'post', |
|---|
| 108 | + 'hierarchical' => false, |
|---|
| 109 | + 'rewrite' => false, |
|---|
| 110 | + 'query_var' => false, |
|---|
| 111 | + ), |
|---|
| 112 | + 'revision' => array('label' => __('Revisions'), |
|---|
| 113 | + 'singular_label' => __('Revision'), |
|---|
| 114 | + 'public' => false, |
|---|
| 115 | + '_builtin' => true, |
|---|
| 116 | + '_edit_link' => 'revision.php?revision=%d', |
|---|
| 117 | + 'capability_type' => 'post', |
|---|
| 118 | + 'hierarchical' => false, |
|---|
| 119 | + 'rewrite' => false, |
|---|
| 120 | + 'query_var' => false, |
|---|
| 121 | + ), |
|---|
| 122 | + 'nav_menu_item' => array( 'public' => false, |
|---|
| 123 | + 'show_ui' => false, |
|---|
| 124 | + '_builtin' => true, |
|---|
| 125 | + 'capability_type' => 'post', |
|---|
| 126 | + 'hierarchical' => false, |
|---|
| 127 | + 'rewrite' => false, |
|---|
| 128 | + 'query_var' => false, |
|---|
| 129 | + ), |
|---|
| 130 | + ); |
|---|
| 131 | + return $initial_post_types; |
|---|
| 132 | +} |
|---|
| 133 | + |
|---|
| 134 | /** |
|---|
| 135 | * Retrieve attached file path based on attachment ID. |
|---|
| 136 | * |
|---|