Timeline for Add Metabox to all custom post types
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 15, 2020 at 8:21 | history | edited | CommunityBot |
Commonmark migration
|
|
Sep 2, 2013 at 16:19 | comment | added | Ari | See the documentation here codex.wordpress.org/Function_Reference/get_post_types to be combined with the answer above. That page is about how to get all registered post types. | |
Jul 17, 2013 at 21:00 | comment | added | mtuttle | I tried this one and got a blank screen: $post_types = array( 'nemultispecies', 'atlanticseascallop', 'monkfish', 'atlanticherring', 'smallmeshmulti', 'smallmeshmulti', 'atlanticseascallop', 'atlanticseascallop', 'atlanticseascallop', 'atlanticseascallop', ); // and so forth foreach( $post_types as $post_type) { add_meta_box( 'my-meta-box-id2', 'Enter your PDF location for your post category below:', 'cd2_meta_box_cb', $post_type, 'normal', 'high' ); } | |
Jul 17, 2013 at 15:36 | comment | added | Pat J |
I fixed the 2nd code sample to actually use the $post_type variable. Is it still giving you an error? It could also be that the first parameter (id ) needs to be unique.
|
|
Jul 17, 2013 at 15:35 | history | edited | Pat J | CC BY-SA 3.0 |
fixed code sample
|
Jul 17, 2013 at 15:20 | comment | added | mtuttle | Also, am I missing something with this? When I place two of the custom post type names into the array, I'm getting a server error: $post_types = array( 'nemultispecies', 'monkfish', ); // and so forth foreach( $post_types as $post_type) { add_meta_box( 'my-meta-box-id2', 'Enter your PDF location for your post category below:', 'cd2_meta_box_cb', 'your_custom_post_type_name', 'normal', 'high' ); } | |
Jul 17, 2013 at 15:15 | comment | added | mtuttle | Ok, so no way to do it without coding them in functions.php ? | |
Jul 17, 2013 at 14:57 | history | answered | Pat J | CC BY-SA 3.0 |