Making WordPress.org


Ignore:
Timestamp:
03/05/2021 12:05:23 AM (4 years ago)
Author:
coffee2code
Message:

Handbooks: Use WPorg_Handbook_Init::get_post_types() as the canonical source for obtaining all handbook post types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/init.php

    r10767 r10768  
    4747         * @param array $handbooks Array of handbook post types. Default 'handbook'.
    4848         */
    49         return (array) apply_filters( 'handbook_post_types', array( 'handbook' ) );
     49        $post_types = (array) apply_filters( 'handbook_post_types', [ 'handbook' ] );
     50        return array_map(
     51            function( $pt ) {
     52                $pt = sanitize_title( $pt );
     53                return ( in_array( $pt, [ 'handbook', 'page' ] ) || false !== strpos( $pt, '-handbook' ) ) ? $pt : $pt . '-handbook';
     54            },
     55            $post_types
     56        );
    5057    }
    5158
Note: See TracChangeset for help on using the changeset viewer.