jon-c
12/13/2016 - 10:35 PM

dont use this, scratch example

dont use this, scratch example

// The Field
$this->cmb_resource_form->add_field( array(
	'name'     => 'Seasons',
	'desc'     => '',
	'id'       => $this->cmb_prefix . 'seasons',
	'taxonomy' => 'season', //Enter Taxonomy Slug
	'type'     => 'taxonomy_multicheck',
	// Optional:
	'options' => array(
		'no_terms_text' => 'Sorry, no seasons could be found.' // Change default text. Default: "No terms"
	),
) );



// The processing

$cmb = $this->frontend_cmb2_get();

// Check security nonce
if ( ! isset( $_POST[ $cmb->nonce() ] ) || ! wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() ) ) {

	return $cmb->prop( 'submission_error', new WP_Error( 'security_fail', __( 'Security check failed.' ) ) );
}

// Check title submitted
if ( empty( $_POST[$this->cmb_prefix .'submitted_post_title'] ) ) {

	return $cmb->prop( 'submission_error', new WP_Error( 'post_data_missing', __( 'New post requires a title.' ) ) );
}
echo 'just post ';
var_dump($_POST);

// Fetch sanitized values
$sanitized_values = $cmb->get_sanitized_values( $_POST );

echo 'sanitized';
var_dump($sanitized_values);