• michael walker

    (@michael-walker)


    Is it possible, when defining a text field, to insert some default text into the box? I am just looking to make the form/nature of the input desired clear to the user without having a hugely long field label explaining it all. Many thanks for any assistance.

    https://wordpress.org/plugins/wp-members/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    You could do that by constructing a filter function to do so. The form rows are passed as an array to the wpmem_register_form_rows filter. This filter is documented here, but essentially, each row is an array of the various parts of the row. The part you would need to change would the “field” key.

    A generic example where your field’s option name is “option_name” might look like this:

    add_filter( 'wpmem_register_form_rows', 'my_register_form_rows_filter', 10, 2 );
    function my_register_form_rows_filter( $rows, $toggle ) {
    
    	$rows['option_name']['field'] = '<input name="option_name" type="text" id="option_name" value="some default value" class="textbox" />';
    
    	return $rows;
    }
    Thread Starter michael walker

    (@michael-walker)

    Many thanks for the prompt and helpful reply – I will try that.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Specify Default Text in Text box/Text Area?’ is closed to new replies.