Problem:
I add a snippet to limit the number of words for post content in the form and I get this error:
Cannot redeclare function my_validation.
Solution:
Change the name of the function as you used that somewhere else on your WordPress installation:
add_filter('cred_form_validate','chr_validation',10,2); function chr_validation($field_data, $form_data) { //field data are field values and errors list($fields,$errors)=$field_data; //check if post_title field is more than 500 words if ( str_word_count($fields['post_content']['value']) > 500 ) { //set error message for post_content field $errors['post_content']='500 word count exceeded. Please, use less words for your description.'; } //return result return array($fields,$errors); }
Relevant Documentation:
https://toolset.com/forums/topic/limit-word-count-on-cred-post_content-field/
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
This topic contains 2 replies, has 2 voices.
Last updated by 1 year, 5 months ago.
Assisted by: Christopher Amirian.