Make WordPress Core


Ignore:
Timestamp:
06/28/2016 04:40:33 PM (10 years ago)
Author:
ocean90
Message:

Posts: Introduce WP_Post_Type and use it in register_post_type() and unregister_post_type().

This changes the global $wp_post_types to an array of WP_Post_Type objects. WP_Post_Type includes methods to handle post type supports, rewrite rules, meta boxes, hooks, and taxonomies.
Each post type argument becomes a property of WP_Post_Type.

Props swissspidy, flixos90.
Fixes #36217.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/types.php

    r37459 r37890  
    3030
    3131        $pobj = get_post_type_object( 'foo' );
    32         $this->assertInstanceOf( 'stdClass', $pobj );
     32        $this->assertInstanceOf( 'WP_Post_Type', $pobj );
    3333        $this->assertEquals( 'foo', $pobj->name );
    3434
     
    555555     *
    556556     * @param array $args register_post_type() arguments.
    557      * @return stdClass Post type object for `$this->post_type`.
     557     * @return WP_Post_Type Post type object for `$this->post_type`.
    558558     */
    559559    public function register_post_type( $args = array() ) {
Note: See TracChangeset for help on using the changeset viewer.