mikeschinkel at newclarity.net
Wed Sep 22 07:32:29 UTC 2010
On Sep 22, 2010, at 2:46 AM, Andrew Nacin wrote:
> The $id global or $post->ID or $post_id will all get you what you need.
> Instead of a custom function (with no guarantee we won't break it in the
> future), I think the problem is that you're relying on a hook that is too
> early for what you want. admin_init runs really early on a typical admin
> page. Even load-$pagenow runs too early for a lot of stuff. And even if they
> weren't too early, they're too generalized and they would require you to
> make all sorts of duplicative checks that the admin later makes for you.
> (There's a lot of branching in post.php for example.)
> There are metabox-specific hooks after the add_meta_box() calls and before
> they are generated, which would be the perfect time and context to remove,
> add, or adjust meta boxes.
A follow up. It seems $current_screen is planning to replace the $typenow and $pagenow functions as the preferred method, right?
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?
More information about the wp-hackers