Last active
December 13, 2016 22:35
-
-
Save jondcampbell/b89011d95a6a22702582f4bcdf2ca814 to your computer and use it in GitHub Desktop.
dont use this, scratch example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment