Skip to content

Instantly share code, notes, and snippets.

@jnijstad
Created August 10, 2016 11:47
Show Gist options
  • Select an option

  • Save jnijstad/165ccded7fbaed2d5b980d7878a7976d to your computer and use it in GitHub Desktop.

Select an option

Save jnijstad/165ccded7fbaed2d5b980d7878a7976d to your computer and use it in GitHub Desktop.
Re-order the default fields in WordPress comment_form()
<?php
function review_fields($fields){
settype($fields, "array"); //somehow the $fields is originally a weird array-like string
// the empty strings will be replaced at the array merge
$order = array(
"author" => '',
"email" => '',
"url" => '',
"comment" => '',
);
$fields = array_merge($order,$fields);
return $fields;
}
// reshuffle fields in review
add_action('comment_form_fields', 'review_fields', 10, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment