WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #17447, comment 2


Ignore:
Timestamp:
05/17/11 04:35:02 (4 years ago)
Author:
mikeschinkel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17447, comment 2

    initial v1  
    44Red-faced, didn't know about `add_post_type_support()`. 
    55 
    6 However, that function doesn't allow me to intercept all `$args` passed to `register_post_type()` and change some of them before the `register_post_type()` operates on the `$args`. One example would be to set `$args->rewrite = false;` for all post types using a `pre_register_post_type` hook, and then define the rewrites differently using the `register_post_type` hook; this is exactly something I need right now for a project I'm working on. 
     6However, that function doesn't allow someone to intercept all `$args` passed to `register_post_type()` and change some of them before the `register_post_type()` operates on the `$args`. One example would be to set `$args->rewrite = false;` for all post types using a `pre_register_post_type` hook, and then define the rewrites differently using the `register_post_type` hook; this is exactly something I need right now for a project I'm working on. 
    77 
    88A plugin developer may want to provide alternate rules for post type archives so it might want to set `$args->has_archive = false;` using a `pre_register_post_type` hook, and then define the post type archives differently using the `register_post_type` hook. This is also something I need. 
    99 
    10 In addition I may want to provide an admin console option that allows the end user to define all the visibility settings for the different post types; a `pre_register_post_type` hook would enable that. 
     10In addition a plugin developer may want to provide an admin console option that allows the end user to define all the visibility settings for the different post types; a `pre_register_post_type` hook would enable that. 
    1111 
    12 Another example is`$args->columns` which would include a keyed array of headers and callbacks and/or  `$args->column_headers` containing an array of headers and `$args->column_callbacks` containing an array of callbacks. 
     12Another example is`$args->columns` which would include a keyed array of headers and callbacks and/or  `$args->column_headers` containing an array of headers and `$args->column_callbacks` containing an array of callbacks. And yet another example would be to add `$args->meta_boxes` which would include a keyed array of `meta_box` args. 
    1313 
    14 And yet another example would be to add `$args->meta_boxes` which would include a keyed array of `meta_box` args. 
    15  
    16 And those examples are all the ones I currently would like to add support for, some to make it easier to define a full-features custom post type and some to keep WordPress from doing work that I'm simply going to throw away. 
     14As stated, some of those examples are ones I currently would like to be able to streamline by specifying in the register_post_type()` call making it easier to define a full-features custom post type, and some of these examples of trying to keep WordPress from doing work to create data that is simply going to be thrown away. 
    1715 
    1816