Skip to content

Instantly share code, notes, and snippets.

@merli129
Last active February 20, 2017 20:41
Show Gist options
  • Select an option

  • Save merli129/7da0355604d5001ea0448d02e4bf420a to your computer and use it in GitHub Desktop.

Select an option

Save merli129/7da0355604d5001ea0448d02e4bf420a to your computer and use it in GitHub Desktop.
Wordpress comment fields order
<?php
add_filter('comment_form_fields', 'qoob_reorder_comment_fields');
function qoob_reorder_comment_fields($fields){
$new_fields = array();
$myorder = array('author', 'email', 'comment');
foreach($myorder as $key){
$new_fields[$key] = $fields[$key];
unset($fields[$key]);
}
if($fields){
foreach($fields as $key => $val)
$new_fields[$key] = $val;
}
return $new_fields;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment