Make WordPress Core

Changeset 12937


Ignore:
Timestamp:
02/03/2010 06:54:42 PM (14 years ago)
Author:
ryan
Message:

Allow registering a meta box callback for setting up meta boxes when creating the edit form for a custom post type. see #9674

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r12927 r12937  
    140140    add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', $post_type, 'normal', 'core');
    141141
     142do_action('add_meta_boxes', $post_type, $post);
     143do_action('add_meta_boxes_' . $post_type, $post);
     144
    142145do_action('do_meta_boxes', $post_type, 'normal', $post);
    143146do_action('do_meta_boxes', $post_type, 'advanced', $post);
  • trunk/wp-includes/post.php

    r12927 r12937  
    709709 * hierarchical - Whether the post type is hierarchical. Defaults to false.
    710710 * supports - An alias for calling add_post_type_support() directly. See add_post_type_support() for Documentation. Defaults to none.
     711 * register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form.  Do remove_meta_box() and add_meta_box() calls in the callback.
    711712 *
    712713 * @package WordPress
     
    725726
    726727    // Args prefixed with an underscore are reserved for internal use.
    727     $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array());
     728    $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null);
    728729    $args = wp_parse_args($args, $defaults);
    729730    $args = (object) $args;
     
    783784        $wp_rewrite->add_permastruct($post_type, "/{$args->rewrite['slug']}/%$post_type%", $args->rewrite['with_front']);
    784785    }
     786
     787    if ( $args->register_meta_box_cb )
     788        add_action('add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1);
    785789
    786790    $wp_post_types[$post_type] = $args;
Note: See TracChangeset for help on using the changeset viewer.