WordPress.org

Make WordPress Core

Ticket #17447: register_post_type_hook.diff

File register_post_type_hook.diff, 722 bytes (added by mikeschinkel, 4 years ago)

Adds 'pre_register_post_type' and 'register_post_type' hooks to register_post_type().

  • wp-includes/post.php

     
    910910                'permalink_epmask' => EP_PERMALINK, 'can_export' => true, 'show_in_nav_menus' => null, 'show_in_menu' => null, 
    911911        ); 
    912912        $args = wp_parse_args($args, $defaults); 
    913         $args = (object) $args; 
     913        $args = (object) apply_filters( 'pre_register_post_type', $args, $post_type ); 
    914914 
    915915        $post_type = sanitize_key($post_type); 
    916916        $args->name = $post_type; 
     
    10171017                register_taxonomy_for_object_type( $taxonomy, $post_type ); 
    10181018        } 
    10191019 
    1020         return $args; 
     1020        return apply_filters( 'register_post_type', $args, $post_type ); 
    10211021} 
    10221022 
    10231023/**