2 metaboxes in admin area
-
I have a strange problem i never had before. I put this code in function.php (i had exactly the same from another site just before this with the same version of wordpress)
function my_attachments( $attachments ) { $fields = array( array( 'name' => 'title', // unique field name 'type' => 'text', // registered field type 'label' => __( 'Title', 'attachments' ), // label to display 'default' => 'title', // default value upon selection ), array( 'name' => 'caption', // unique field name 'type' => 'textarea', // registered field type 'label' => __( 'Caption', 'attachments' ), // label to display 'default' => 'caption', // default value upon selection ), ); $args = array( // title of the meta box (string) 'label' => 'Gestione Allegati', // all post types to utilize (string|array) 'post_type' => array( 'post', 'page' ), // meta box position (string) (normal, side or advanced) 'position' => 'normal', // meta box priority (string) (high, default, low, core) 'priority' => 'high', // allowed file type(s) (array) (image|video|text|audio|application) 'filetype' => null, // no filetype limit // by default new Attachments will be appended to the list // but you can have then prepend if you set this to false 'append' => true, // text for 'Attach' button in meta box (string) 'button_text' => __( 'Allega file', 'attachments' ), // text for modal 'Attach' button (string) 'modal_text' => __( 'Allega', 'attachments' ), // which tab should be the default in the modal (string) (browse|upload) 'router' => 'browse', // fields array 'fields' => $fields, ); $attachments->register( 'my_attachments', $args ); // unique instance name } add_action( 'attachments_register', 'my_attachments' );
and in the admin area both in posts and in pages i find two metaboxes instead than one.
the first one is the default one and the second one is the one i put on my function.php file. It seems that doesn’t overwrites the istance
Do you know what could be the problem?ps. i also checked the version of attachments installed in both sites and they are the same, the last version 3.5.5
thank you
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘2 metaboxes in admin area’ is closed to new replies.