diff --git src/wp-includes/post-functions.php src/wp-includes/post-functions.php
index fdd01ee..4733f3b 100644
|
|
|
function register_post_type( $post_type, $args = array() ) { |
| 986 | 986 | if ( ! is_array( $wp_post_types ) ) |
| 987 | 987 | $wp_post_types = array(); |
| 988 | 988 | |
| | 989 | // Sanitize post type name. |
| | 990 | $post_type = sanitize_key( $post_type ); |
| | 991 | |
| | 992 | if ( empty( $args['_builtin'] ) ) { |
| | 993 | /** |
| | 994 | * Filter the arguments for registering a post type. |
| | 995 | * |
| | 996 | * Not available for built-in post types. |
| | 997 | * |
| | 998 | * @since 4.4.0 |
| | 999 | * |
| | 1000 | * @param array|string $args Array or string of arguments for registering a post type. |
| | 1001 | * @param string $post_type Post type key. |
| | 1002 | */ |
| | 1003 | $args = apply_filters( 'register_post_type_args', $args, $post_type ); |
| | 1004 | } |
| | 1005 | |
| 989 | 1006 | // Args prefixed with an underscore are reserved for internal use. |
| 990 | 1007 | $defaults = array( |
| 991 | 1008 | 'labels' => array(), |
| … |
… |
function register_post_type( $post_type, $args = array() ) { |
| 1017 | 1034 | $args = wp_parse_args( $args, $defaults ); |
| 1018 | 1035 | $args = (object) $args; |
| 1019 | 1036 | |
| 1020 | | $post_type = sanitize_key( $post_type ); |
| 1021 | 1037 | $args->name = $post_type; |
| 1022 | 1038 | |
| 1023 | 1039 | if ( empty( $post_type ) || strlen( $post_type ) > 20 ) { |