Reply To: Set default value to field if this value still not exist
Support › General › ✅Set default value to field if this value still not exist › Reply To: Set default value to field if this value still not exist
January 18, 2019 at 4:24 PM
#13053
Keymaster
Hi Jefferson,
You can use std
attribute for a text field, like this:
$post_id = isset( $_GET['post'] ) ? intval( $_GET['post'] ) : ( isset( $_POST['post_ID'] ) : intval( $_POST['post_ID'] ) : false );
$meta_boxes[] = [
'fields' => [
[
'type' => 'text',
'id' => 'color',
'std' => generate_my_own_code( $post_id ),
],
],
];