0
blayke
4y

How the fuck do i save metabox input value in database.
This is my code:

add_action( 'add_meta_boxes', 'Wp_metabox' );
add_action('save_post', 'wp_custom_save');

function Wp_metabox()
{

add_meta_box(
'wp_custom__metabox',
'Custom Meta Box Title',
'wp_custom_metabox_callback',
'slider',
'advanced',
);
}

function WP_custom_metabox_callback($post)
{
<input id="text"
type="text" value="text" />
}

function wp_custom_save($post_id)
{
$text = sanitize_text_field($_POST['text']);
update_post_meta($post_id, '_text', $text);
}

How in the fuking world do i get the input value of the field and then save the value in database? There is no documentation for this shit.

Comments
Add Comment