[wp-hackers] $postnow?

Andrew Nacin wp at andrewnacin.com
Wed Sep 22 07:43:26 UTC 2010


On Wed, Sep 22, 2010 at 3:26 AM, Mike Schinkel
<mikeschinkel at newclarity.net>wrote:
>
> Can you suggest some specific hooks?  In tracing the code via a debugger I
> don't find any obviously appropriate candidates.
>

I would start with:

do_action('add_meta_boxes', $post_type, $post);
do_action('add_meta_boxes_' . $post_type, $post);


> And aren't post types supposed to be complete after init?  What about other
> plugins who might decide to inspect the post types and take action in a
> load-{$pagenow} hook or an $admin_action{$action} hook?
>

As of right now, it's a bit of a crapshoot.
http://core.trac.wordpress.org/ticket/14886

> A follow up.  It seems $current_screen is planning to replace the $typenow
and $pagenow functions as the preferred method, right?

$typenow was added in 3.0 I think. Regardless, yes, $current_screen is far
more powerful than $pagenow.

> Is there a compelling reason why $current_screen cannot be set in core
before init and admin_init?  It would seem that information like current
post type, post ID, taxonomy etc are exactly the types of information that
should be available in init/admin_init?

Re: compelling reason, not really. See also the ticket above. I wouldn't
mind restructuring things in there to make things more consistent.


More information about the wp-hackers mailing list