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.
Dieses Thema enthält 2 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 2 years, 6 months.
Assistiert von: Christopher Amirian.