[wp-hackers] Adding a meta_box to all Post Types

Dagan Henderson Dagan.Henderson at epyllion.com
Mon Nov 21 18:16:25 UTC 2011


I just did this the other day, James, so good timing.

Just geet a list of post types and loop through it:

	$post_types = get_post_types( array( '_builtin' => false ), 'objects' );  // Gets all custom types

	array_push( $post_types, get_post_type_object( 'post' ), get_post_type_object( 'page')  ); // Adds back the 'post' and 'page' types while ommitting attachments, revisions, menus, etc.

	foreach ( $post_types as $type ) {

		add_meta_box( . . . );
	}

Happy coding!


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of James Laws
Sent: Monday, November 21, 2011 6:20 AM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] Adding a meta_box to all Post Types

Could anyone point me in the right direction to add custom meta box to all public post types?

Thanks in advance.

James
_______________________________________________
wp-hackers mailing list
wp-hackers at lists.automattic.com
http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list