Viewing 1 replies (of 1 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    You can set max title length using this code

    add_filter( 'adverts_form_load', 'set_title_max_length' );
     function set_title_max_length( $form ) {
    
         if( $form['name'] != 'advert' ) {
             return $form;
         }
    
         foreach( $form["field"] as $k => $field ) {
             if( $field["name"] == "post_title" ) {
                 $field["validator"][] = array(
                     "name" => "string_length",
                     "params" => array(
                       "max" => 100
                     )
                 );
                $form["field"][$k] = $field;
             }
         }
    
         return $form;
     }

    where 100 is max text length.

Viewing 1 replies (of 1 total)
  • The topic ‘max lenght for title field’ is closed to new replies.