Make WordPress Core

Ticket #34009: 34009.patch

File 34009.patch, 2.8 KB (added by bobbingwide, 7 years ago)

Adds get_all_post_type_supports_features and post_type_supports filter hooks

  • src/wp-includes/default-filters.php

     
    421421add_action( 'wp_trash_post',      '_reset_front_page_settings_for_post' );
    422422add_action( 'change_locale', 'create_initial_post_types' );
    423423
     424add_filter( 'post_type_supports', 'post_type_supports_core' );
     425add_filter( 'post_type_supports', 'post_type_supports_unknown_registered', 12 );
     426
    424427// Post Formats
    425428add_filter( 'request', '_post_format_request' );
    426429add_filter( 'term_link', '_post_format_link', 10, 3 );
  • src/wp-includes/post.php

     
    15861586}
    15871587
    15881588/**
     1589 * Lists all the currently registered post type supports options
     1590 *
     1591 * @return array all the supports options that could possibly be chosen
     1592 */
     1593function get_all_post_type_supports_features() {
     1594        $supports_options = array();
     1595        $supports_options = apply_filters( "post_type_supports", $supports_options );
     1596        return $supports_options;
     1597}
     1598
     1599/**
     1600 * Returns the 'core' options used in add_post_type_supports()
     1601 *
     1602 * The full set may include features that are only available for certain post types
     1603 *
     1604 * @param array $supports_options
     1605 * @return array The core set
     1606 */
     1607function post_type_supports_core( $supports_options ) {
     1608        $supports_options['author'] = __( "Author" );
     1609        $supports_options['comments'] = __( "Comments" );
     1610        $supports_options['custom-fields'] = __( "Custom fields" );
     1611        $supports_options['editor'] = __( "Content editor" );
     1612        $supports_options['excerpt'] = __( "Excerpt" );
     1613        $supports_options['page-attributes'] = __( "Page attributes" );
     1614        $supports_options['post-formats'] = __( "Post formats" );
     1615        $supports_options['revisions'] = __( "Revisions" );
     1616        $supports_options['thumbnail'] = __( "Thumbnail - featured image" );
     1617        $supports_options['trackbacks'] = __( "Trackbacks" );
     1618  $supports_options['title'] = __( "Title" );
     1619        return( $supports_options );
     1620}
     1621
     1622/**
     1623 * Implements "post_type_supports" to add any remaining registered ones
     1624 *
     1625 * @param array $supports_options
     1626 * @return array Updated with the 'unknown' values
     1627 */
     1628function post_type_supports_unknown_registered( $supports_options ) {
     1629        global $_wp_post_type_features;
     1630        foreach ( $_wp_post_type_features as $post_type => $features ) {
     1631                foreach ( $features as $key => $value ) {
     1632                        if ( !isset( $supports_options[ $key ] ) ) {
     1633                                $supports_options[ $key ] = $key;
     1634                        }
     1635                }
     1636        }
     1637        return( $supports_options );
     1638}
     1639
     1640/**
    15891641 * Update the post type for the post ID.
    15901642 *
    15911643 * The page or post cache will be cleaned for the post ID.