WordPress.org

Make WordPress Core

Ticket #40413: 40413.2.diff

File 40413.2.diff, 2.3 KB (added by desrosj, 2 years ago)

Update the docblocks for register_post_type() and add_post_type_supports() to describe passing an array for feature support.

  • src/wp-includes/post.php

     
    12721272 * @since 4.6.0 Post type object returned is now an instance of `WP_Post_Type`.
    12731273 * @since 4.7.0 Introduced `show_in_rest`, `rest_base` and `rest_controller_class`
    12741274 *              arguments to register the post type in REST API.
    1275  *
     1275 * @since 5.3.0 The `supports` argument will now accept an array of arguments for a feature.
     1276 * .
    12761277 * @global array $wp_post_types List of post types.
    12771278 *
    12781279 * @param string $post_type Post type key. Must not exceed 20 characters and may
     
    13421343 *                                              'page-attributes', 'thumbnail', 'custom-fields', and 'post-formats'.
    13431344 *                                              Additionally, the 'revisions' feature dictates whether the post type
    13441345 *                                              will store revisions, and the 'comments' feature dictates whether the
    1345  *                                              comments count will show on the edit screen. Defaults is an array
     1346 *                                              comments count will show on the edit screen. A feature can also be
     1347 *                                              specified as an array of arguments to provide additional information
     1348 *                                              about supporting that feature. Example: `array( 'my_feature', array(
     1349 *                                              'field' => 'value' ) )`. Default is an array.
    13461350 *                                              containing 'title' and 'editor'.
    13471351 *     @type callable    $register_meta_box_cb  Provide a callback function that sets up the meta boxes for the
    13481352 *                                              edit form. Do remove_meta_box() and add_meta_box() calls in the
     
    18001804 * store revisions, and the 'comments' feature dictates whether the comments
    18011805 * count will show on the edit screen.
    18021806 *
     1807 * A third, optional parameter can also be passed along with a feature to provide
     1808 * additional information about supporting that feature.
     1809 *
    18031810 * Example usage:
    18041811 *
    18051812 *     add_post_type_support( 'my_post_type', 'comments' );