Closed sb-lc closed 10 years ago
Hi @sb-lc! Where you're registering the field, add the sanitization_cb
as per the example:
array(
'name' => 'Cooking time',
'id' => $prefix . 'cooking_time',
'desc' => 'Cooking time',
'options' => array(
'5' => '5 minutes',
'10' => '10 minutes',
'30' => 'Half an hour',
'60' => '1 hour',
),
'type' => 'pw_select',
'sanitization_cb' => 'pw_select2_sanitise',
),
Let me know how you get on.
thanks
I am still getting this message though -
Warning: implode(): Invalid arguments passed in C:\wamp\www\lc-dev1\wp-content\plugins\medusa_custom_meta_boxes\fields\cmb-field-select2-master\cmb-field-select2.php on line 80
here is my field definition -
array(
'name' => 'Venue',
'desc' => 'Choose Venue',
'id' => $prefix . 'venue',
'type' => 'pw_multiselect',
'options' => cmb_get_venue_post_options( array( 'post_type' => 'venue', 'numberposts' => -1, 'orderby' => 'post_title', 'order' => 'ASC' ) ),
'sanitization_cb' => 'pw_select2_sanitise',
),
the output of callback function is the same -
[11-Nov-2014 16:48:49 UTC] Array ( [36] => De Montfort Hall [55] => Leicester College - Bede Island Centre [42] => Leicester College - City Skills Centre [51] => Leicester College - Freemen's Park Campus [39] => Leicester College – Abbey Park Campus [40] => Leicester College – St Margaret’s Campus [54] => The Curve [53] => The Depot [52] => The Empire )
This should have fixed it. You may have to delete the existing, saved meta value.
you are correct, if i add new post the message is gone, thanks for your help :)
Hi, I am getting this error :l
( ! ) Warning: implode(): Invalid arguments passed in C:\wamp\www\lc-dev1\wp-content\plugins\medusa_custom_meta_boxes\cmb-field-select2-master\cmb-field-select2.php on line 80
my field definition :+1: array( 'name' => 'Venue', 'desc' => 'Choose Venue', 'id' => $prefix . 'venue', 'type' => 'pw_multiselect', 'options' => cmb_get_venue_post_options( array( 'post_type' => 'venue', 'numberposts' => -1, 'orderby' => 'post_title', 'order' => 'ASC' ) ), ),
my output from cmb_get_venue_post_options() is :-
Array ( [36] => De Montfort Hall [55] => Leicester College - Bede Island Centre [42] => Leicester College - City Skills Centre [51] => Leicester College - Freemen's Park Campus [39] => Leicester College – Abbey Park Campus [40] => Leicester College – St Margaret’s Campus [54] => The Curve [53] => The Depot [52] => The Empire )
I cant see how this is different from the example given in the docs:
array( 'name' => 'Ingredients', 'id' => $prefix . 'ingredients', 'desc' => 'Select ingredients. Drag to reorder.', 'options' => array( 'flour' => 'Flour', 'salt' => 'Salt', 'eggs' => 'Eggs', 'milk' => 'Milk', 'butter' => 'Butter', ), 'type' => 'pw_multiselect', ),
Thanks very much for your help
simon