Make WordPress Core


Ignore:
Timestamp:
02/06/2010 05:27:30 PM (17 years ago)
Author:
ryan
Message:

Add a separate show_ui flag for post types. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r12992 r12993  
    1717function create_initial_post_types() {
    1818        register_post_type( 'post', array(      'label' => __('Posts'),
    19                                                                                 'publicly_queryable' => true,
    20                                                                                 'exclude_from_search' => false,
     19                                                                                'public' => true,
     20                                                                                'show_ui' => false,
    2121                                                                                '_builtin' => true,
    2222                                                                                '_edit_link' => 'post.php?post=%d',
    … …  
    2929
    3030        register_post_type( 'page', array(      'label' => __('Pages'),
    31                                                                                 'publicly_queryable' => true,
    32                                                                                 'exclude_from_search' => false,
     31                                                                                'public' => true,
     32                                                                                'show_ui' => false,
    3333                                                                                '_builtin' => true,
    3434                                                                                '_edit_link' => 'post.php?post=%d',
    … …  
    4141
    4242        register_post_type( 'attachment', array('label' => __('Media'),
    43                                                                                         'exclude_from_search' => false,
     43                                                                                        'public' => true,
     44                                                                                        'show_ui' => false,
    4445                                                                                        '_builtin' => true,
    4546                                                                                        '_edit_link' => 'media.php?attachment_id=%d',
    … …  
    5152
    5253        register_post_type( 'revision', array(  'label' => __('Revisions'),
    53                                                                                         'exclude_from_search' => true,
     54                                                                                        'public' => false,
    5455                                                                                        '_builtin' => true,
    5556                                                                                        '_edit_link' => 'revision.php?revision=%d',
    … …  
    705706 * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public.
    706707 * publicly_queryable - Whether post_type queries can be performed from the front page.  Defaults to whatever public is set as.
     708 * show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public.
    707709 * inherit_type - The post type from which to inherit the edit link and capability type. Defaults to none.
    708710 * capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post".
    … …  
    733735
    734736        // Args prefixed with an underscore are reserved for internal use.
    735         $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array() );
     737        $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null );
    736738        $args = wp_parse_args($args, $defaults);
    737739        $args = (object) $args;
    … …  
    743745        if ( null === $args->publicly_queryable )
    744746                $args->publicly_queryable = $args->public;
     747
     748        // If not set, default to the setting for public.
     749        if ( null === $args->show_ui )
     750                $args->show_ui = $args->public;
    745751
    746752        // If not set, default to true if not public, false if public.
    … …  
    765771        if ( empty($args->delete_cap) )
    766772                $args->delete_cap = 'delete_' . $args->capability_type;
    767 
    768         if ( !$args->_builtin && $args->public )
    769                 $args->_show = true;
    770773
    771774        if ( ! empty($args->supports) ) {
Note: See TracChangeset for help on using the changeset viewer.