miriamdepaula

WordPress: Adicionando metabox a todos os post types

Nov 21st, 2011
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. $post_types = get_post_types( array( '_builtin' => false ), 'objects' );  // Gets all custom types
  4.  
  5.        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.
  6.  
  7.        foreach ( $post_types as $type ) {
  8.  
  9.                add_meta_box( . . . );
  10.        }
  11.  
  12. ?>
  13.  
Advertisement
Add Comment
Please, Sign In to add comment