0

I'm pretty new to Wordpress development, I'm learning about custom post types, custom taxonomies & meta boxes at the moment, following various tutorials online. So please forgive any mistakes!

I've got a custom post-type set up, and a meta box with input field too, yet I can't seem to set the permanent position of the meta box. Here's the code:

function add_discography_metaboxes() {
    add_meta_box('meta_album_info', 'Album Information', 'meta_album_info', 'discography', 'normal', 'high');
}

I can drag the Album Information meta box from the main section to the side, is this cause of a problem with code? or can you drag a meta box anywhere even if the position is set?

1 Answer 1

2

Metaboxes are always draggable, that is the default behavior.

You can place the box content on another position, see this example. But you should be absolutely sure the user wants that. I don’t recommend it.

2
  • Thanks for the reply @toscho. So the position set in the function is the default position, but if dragged wordpress caches where you've moved it too and keeps it there for that user? (I'd set it to sidebar - then dragged to normal position, after that no matter what I set in the function it always stayed in normal position.)
    – Brad Adams
    May 1, 2014 at 11:42
  • @breadadams Yes, the position is saved in a user meta field.
    – fuxia
    May 1, 2014 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.