I'm familiar with adding custom meta boxes to my post types in WordPress but this is something I've not had to do before. I want to be able to select a user from a dropdown (in a metabox) and have that value saved with the post.
Here's my code:
function add_users_meta_box() { add_meta_box( 'users_meta_box', // $id 'Assign to user', // $title 'show_users_meta_box', // $callback 'property', // $page 'side', // $context 'high'); // $priority } add_action('add_meta_boxes', 'add_users_meta_box'); function show_users_meta_box() { wp_dropdown_users(array('name' => 'author', 'show_option_none' => '-- None --','selected' => $user_id)); }
Is it possible to extend this to both save the value and when the user re-opens the post to edit, have the position of the dropdown saved.
If anyone could point me in the right direction it would be much appreciated.
I'm familiar with adding custom meta boxes to my post types in WordPress but this is something I've not had to do before. I want to be able to select a user from a dropdown (in a metabox) and have that value saved with the post.
Here's my code:
Is it possible to extend this to both save the value and when the user re-opens the post to edit, have the position of the dropdown saved.
If anyone could point me in the right direction it would be much appreciated.