How to Add Whimsical Form Field Placeholders to WordPress Comment Forms

The WordPress comment form is a humble little thing: a few form fields, an explanation or two, and not much else, barring any plugins or customizations, that is.

Users who have left comments already will be greeted with a form that is already filled out the next time they visit, thanks to a cookie which WordPress sets, but what about before their first comment?

Would-be commenters are greeted by empty form fields for their name, email address, and website address, which is straightforward enough, but what if you want to jazz things up ever so slightly by adding some placeholder text to these form fields? 

We can accomplish this easily enough using the placeholder form fields attribute, and because I wanted to add a bit of whimsy to my forms, I’ve set it up so that a different fake identity is used as a placeholder every time it is loaded.

To accomplish this, add the following block of code to either your site’s functionality plugin or to the appropriate functions file in your theme.

 * Comments form customizations
function custom_comment_form_args( $arg ) {
	$fake_name = custom_get_fake_name();
	$fake_email = strtolower( str_replace( array( '.', '\'', ' ' ), array( '', '', '.' ), $fake_name ) );
 $fake_url = strtolower( str_replace( array( ' ', '.', '\'' ), '', $fake_name ) );

	# Adjust form fields
	$arg['fields']['author'] = str_replace( 'text"', 'text" placeholder="' . $fake_name . '"', $arg['fields']['author'] );
	$arg['fields']['email'] = str_replace( 'email"', 'email" placeholder="' . $fake_email . '"', $arg['fields']['email'] );
	$arg['fields']['url'] = str_replace( 'url"', 'url" placeholder="http://' . $fake_url . '.example/"', $arg['fields']['url'] );

	return $arg;
add_filter( 'comment_form_defaults', 'custom_comment_form_args' );

 * Get a fake name
function custom_get_fake_name() {
	$names = array(
		'Mario Speedwagon',
		'Petey Cruiser',
		'Anna Sthesia',
		'Paul Molive',
		'Anna Mull',
		'Gail Forcewind',
		'Paige Turner',
		'Bob Frapples',
		'Walter Melon',
		'Nick R. Bocker',
		'Barb Ackue',
		'Buck Kinnear',
		'Greta Life',
		'Ira Membrit',
		'Shonda Leer',
		'Brock Lee',
		'Maya Didas',
		'Rick O\'Shea',
		'Pete Sariya',
		'Monty Carlo',
		'Sal Monella',
		'Sue Vaneer',
		'Cliff Hanger',
		'Barb Dwyer',
		'Terry Aki',
		'Cory Ander',
		'Robin Banks',
		'Jimmy Changa',
		'Barry Wine',
		'Wilma Mumduya',
		'Buster Hyman',
		'Poppa Cherry',
		'Zack Lee',
		'Don Stairs',
		'Saul T. Balls',
		'Peter Pants',
		'Hal Appeno',
		'Otto Matic',
		'Moe Fugga',
		'Graham Cracker',
		'Tom Foolery',
		'Al Dente',
		'Bud Wiser',
		'Polly Tech',
		'Holly Graham',
		'Frank N. Stein',
		'Cam L. Toe',
		'Pat Agonia',
		'Tara Zona',
		'Barry Cade',
		'Phil Anthropist', 
		'Marvin Gardens',
		'Phil Harmonic',
		'Arty Ficial',
		'Will Power',
		'Donatella Nobatti',
		'Juan Annatoo',
		'Stew Gots',
		'Anna Rexia',
		'Bill Emia',
		'Curt N. Call',
		'Max Emum',
		'Minnie Mum',
		'Bill Yerds',
		'Hap E. Birthday',
		'Matt Innae',
		'Polly Science',
		'Tara Misu',
		'Ed U. Cation',
		'Gerry Atric',
		'Kerry Oaky',
		'Midge Itz',
		'Gabe Lackmen',
		'Mary Christmas',
		'Dan Druff',
		'Jim Nasium',
		'Angie O. Plasty',
		'Ella Vator',
		'Sal Vidge',
		'Bart Ender',
		'Artie Choke',
		'Hans Olo',
		'Marge Arin',
		'Hugh Briss',
		'Gene Poole',
		'Ty Tanic',
		'Manuel Labor',
		'Lynn Guini',
		'Claire Voyant',
		'Peg Leg',
		'Jack E. Sack',
		'Marty Graw',
		'Ash Wednesday',
		'Olive Yu',
		'Gene Jacket',
		'Tom Atoe',
		'Doug Out',
		'Sharon Needles',
		'Beau Tie',
		'Serj Protector',
		'Marcus Down',
		'Warren Peace',
		'Bud Jet',
		'Barney Cull',
		'Marion Gaze',
		'Eric Shun',
		'Mal Practice',
		'Ed Itorial',
		'Rick Shaw',
		'Paul Issy',
		'Ben Effit',
		'Kat E. Gory',
		'Justin Case',
		'Louie Z. Ana',
		'Aaron Ottix',
		'Ty Ballgame',
		'Anne Fibbiyon',
		'Barry Cuda',
		'John Withawind',
		'Joe Thyme',
		'Mary Goround',
		'Marge Arita',
		'Frank Senbeans',
		'Bill Dabear',
		'Ray Zindaroof',
		'Adam Zapple',
		'Lewis N. Clark',
		'Matt Schtick',
		'Sue Shee',
		'Chris P. Bacon',
		'Doug Lee Duckling',
		'Mason Protesters',
		'Sil Antro',
		'Cal Orie',
		'Sara Bellum',
		'Al Acart',
		'Marv Ellis',
		'Evan Shlee',
		'Terry Bull',
		'Mort Ission',
		'Mark Ette',
		'Ken Tucky',
		'Louis Ville',
		'Colin Oscopy',
		'Fred Attchini',
		'Al Fredo',
		'Penny Tration',
		'Reed Iculous',
		'Chip Zinsalsa',
		'Matt Uhrafact',
		'Jack Dup',
		'Mike Roscope',
		'Lou Sinclark',
		'Faye Daway',
		'Javy Cado',
		'Tom Ollie',
		'Sam Buca',
		'Phil Andererv',
		'Sam Owen',
		'Mary Achi',
		'Ray Cyst',
		'Curtis E. Flush',
		'Holland Oats',
		'Helen Highwater',
		'Eddy Kitt',
		'Al Toesacks',
		'Sir Kim Scision',
		'Elle Bowdrop',
		'Yu Tube',
		'Ellis Dee',
		'Anna Lytics',
		'Sara Bellum',
		'Penny Trate',
		'Phil Erup',
		'Jenna Side',
		'Mary Nara',
		'Mick Donalds',
		'Amber Alert',
		'Vic Tory',
		'Bobby Pin',
		'Dom Inate',
		'Hugh Miliation',
		'Christian Mingle',
		'Juan Soponatime',
		'Dante Sinferno',
		'Ed Zupp',
		'Sarah Yevo',
		'Jess Thetip',
		'Arthur Itis',
		'Faye Sbook',
		'Carrie R. Pigeon',
		'Rachel Slurs',
		'Ty Pryder',
		'Cole Slaw',
		'Pat Ernity',
		'Deb Utant',
		'Luke Warm',
		'Travis Tee',
		'Clara Fication',
		'Paul Itician',
		'Deb Utant',
		'Moe Thegrass',
		'Carol Sell',
		'Scott Schtape',
		'Cody Pendant',
		'Frank Furter',
		'Barry Dalive',
		'Mort Adella',
		'Ray Diation',
		'Mack Adamia',
		'Farrah Moan',
		'Theo Retical',
		'Eda Torial',
		'Mae O\'Nayse',
		'Bella Ruse',
		'Yuri Thra',
		'Tucker Doubt',
		'Cara Larm',
		'Abel Body',
		'Sal Ami',
		'Colin Derr',
		'Cathy Derr',
		'Colin O\'Scopy',
		'Mel Anoma',
		'Adam Up',
		'Lou Zing',
		'Mark Key',
		'Sven Gineer',
		'Mick Rib',
		'Benny Ficial',
		'Genie Inabottle',
		'Gene Therapy',
		'Reggie Stration',
		'Lou Ow',
		'Lance Dorporal',
		'Lou Tenant',
		'Nick Knack',
		'Patty Whack',
		'Reuben Sandwich',
		'Hugo Slavia',
		'Aaron Spacemuseum',
		'Petey Atricks',
		'Dan Delion',
		'Terry Torial',
		'Cal Q. Later',
		'Jen Trification',
		'Indy Nile',
		'Ray Volver',
		'Minnie Strone',
		'Gustav Wind',
		'Paul Samic',
		'Vinny Gret',
		'Joyce Tick',
		'Cliff Diver',
		'Earl E. Riser',
		'Cooke Edoh',
		'Jen Youfelct',
		'Reanne Carnation',
		'Paul Misunday',
		'Chris P. Cream',
		'Gio Metric',
		'Caire Innet',
		'Marsha Mello',
		'Manny Petty',
		'Val Adictorian',
		'Lucy Tania',
		'Jaques Amole',
	$random_name = array_rand( $names );

	return $names[ $random_name ];

That’s all there is to it. Your comment form will now randomly choose an identity with which to provide an example for what is expected to your commenters.

Note that this will only work if your WordPress theme is using the comment_form WordPress function to output the commenting form, otherwise you’ll likely have to create a custom commenting form in a child theme to implement the above changes.

Fake names sourced from The Official Fake Names List.

Leave a Comment

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.

the Rick Beckman archive
Scroll to Top