Changeset 20734
- Timestamp:
- 05/07/2012 04:25:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r20726 r20734 871 871 * 872 872 * - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used. 873 * - labels - An array of labels for this post type. 874 * * If not set, post labels are inherited for non-hierarchical types and page labels for hierarchical ones. 875 * * You can see accepted values in {@link get_post_type_labels()}. 873 876 * - description - A short descriptive summary of what the post type is. Defaults to blank. 874 * - public - Whether posts of this type should be shown in the admin UI. Defaults to false. 875 * - exclude_from_search - Whether to exclude posts with this post type from search results. 876 * Defaults to true if the type is not public, false if the type is public. 877 * - publicly_queryable - Whether post_type queries can be performed from the front page. 878 * Defaults to whatever public is set as. 879 * - show_ui - Whether to generate a default UI for managing this post type. Defaults to true 880 * if the type is public, false if the type is not public. 881 * - show_in_menu - Where to show the post type in the admin menu. True for a top level menu, 882 * false for no menu, or can be a top level page like 'tools.php' or 'edit.php?post_type=page'. 883 * show_ui must be true. 884 * - menu_position - The position in the menu order the post type should appear. Defaults to the bottom. 877 * - public - Whether a post type is intended for use publicly either via the admin interface or by front-end users. 878 * * Defaults to false. 879 * * While the default settings of exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus are 880 * inherited from public, each does not rely on this relationship and controls a very specific intention. 881 * - exclude_from_search - Whether to exclude posts with this post type from front end search results. 882 * * If not set, the the opposite of public's current value is used. 883 * - publicly_queryable - Whether queries can be performed on the front end for the post type as part of parse_request(). 884 * * ?post_type={post_type_key} 885 * * ?{post_type_key}={single_post_slug} 886 * * ?{post_type_query_var}={single_post_slug} 887 * * If not set, the default is inherited from public. 888 * - show_ui - Whether to generate a default UI for managing this post type in the admin. 889 * * If not set, the default is inherited from public. 890 * - show_in_nav_menus - Makes this post type available for selection in navigation menus. 891 * * If not set, the default is inherited from public. 892 * - show_in_menu - Where to show the post type in the admin menu. 893 * * If true, the post type is shown in its own top level menu. 894 * * If false, no menu is shown 895 * * If a string of an existing top level menu (eg. 'tools.php' or 'edit.php?post_type=page'), the post type will 896 * be placed as a sub menu of that. 897 * * show_ui must be true. 898 * * If not set, the default is inherited from show_ui 899 * - show_in_admin_bar - Makes this post type available via the admin bar. 900 * * If not set, the default is inherited from show_in_menu 901 * - menu_position - The position in the menu order the post type should appear. 902 * * show_in_menu must be true 903 * * Defaults to null, which places it at the bottom of its area. 885 904 * - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon. 886 905 * - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'. 887 * May be passed as an array to allow for alternative plurals when using this argument as a base to construct the 888 * capabilities, e.g. array('story', 'stories'). 889 * - capabilities - Array of capabilities for this post type. By default the capability_type is used 890 * as a base to construct capabilities. You can see accepted values in {@link get_post_type_capabilities()}. 906 * * May be passed as an array to allow for alternative plurals when using this argument as a base to construct the 907 * capabilities, e.g. array('story', 'stories'). 908 * - capabilities - Array of capabilities for this post type. 909 * * By default the capability_type is used as a base to construct capabilities. 910 * * You can see accepted values in {@link get_post_type_capabilities()}. 891 911 * - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false. 892 * - hierarchical - Whether the post type is hierarchical . Defaults to false.893 * - supports - An alias for calling add_post_type_support() directly. See {@link add_post_type_support()}894 * for documentation. Defaults to none.912 * - hierarchical - Whether the post type is hierarchical (e.g. page). Defaults to false. 913 * - supports - An alias for calling add_post_type_support() directly. Defaults to title and editor. 914 * * See {@link add_post_type_support()} for documentation. 895 915 * - register_meta_box_cb - Provide a callback function that will be called when setting up the 896 916 * meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback. 897 917 * - taxonomies - An array of taxonomy identifiers that will be registered for the post type. 898 * Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or 899 * register_taxonomy_for_object_type(). 900 * - labels - An array of labels for this post type. By default post labels are used for non-hierarchical 901 * types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}. 902 * - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled. 903 * - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct; 904 * default will use $post_type as slug. Other options include 'with_front', 'feeds', 'pages', and 'ep_mask'. 905 * - query_var - false to prevent queries, or string to value of the query var to use for this post type 906 * - can_export - true allows this post type to be exported. 907 * - show_in_nav_menus - true makes this post type available for selection in navigation menus. 918 * * Default is no taxonomies. 919 * * Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type(). 920 * - has_archive - True to enable post type archives. Default is false. 921 * * Will generate the proper rewrite rules if rewrite is enabled. 922 * - rewrite - Triggers the handling of rewrites for this post type. Defaults to true, using $post_type as slug. 923 * * To prevent rewrite, set to false. 924 * * To specify rewrite rules, an array can be passed with any of these keys 925 * * 'slug' => string Customize the permastruct slug. Defaults to $post_type key 926 * * 'with_front' => bool Should the permastruct be prepended with WP_Rewrite::$front. Defaults to true. 927 * * 'feeds' => bool Should a feed permastruct be built for this post type. Inherits default from has_archive. 928 * * 'pages' => bool Should the permastruct provide for pagination. Defaults to true. 929 * * 'ep_mask' => const Assign an endpoint mask. 930 * * If not specified and permalink_epmask is set, inherits from permalink_epmask. 931 * * If not specified and permalink_epmask is not set, defaults to EP_PERMALINK 932 * - query_var - Sets the query_var key for this post type. Defaults to $post_type key 933 * * If false, a post type cannot be loaded at ?{query_var}={post_slug} 934 * * If specified as a string, the query ?{query_var_string}={post_slug} will be valid. 935 * - can_export - Allows this post type to be exported. Defaults to true. 908 936 * - _builtin - true if this post type is a native or "built-in" post_type. THIS IS FOR INTERNAL USE ONLY! 909 937 * - _edit_link - URL segement to use for edit link of this post type. THIS IS FOR INTERNAL USE ONLY! … … 912 940 * @uses $wp_post_types Inserts new post type object into the list 913 941 * 914 * @param string $post_type Name of the post type.915 * @param array|string $args See above description.942 * @param string $post_type Post type key, must not exceed 20 characters 943 * @param array|string $args See optional args description above. 916 944 * @return object|WP_Error the registered post type object, or an error object 917 945 */ 918 function register_post_type( $post_type, $args = array()) {946 function register_post_type( $post_type, $args = array() ) { 919 947 global $wp_post_types, $wp_rewrite, $wp; 920 948
Note: See TracChangeset
for help on using the changeset viewer.