Last active
February 20, 2017 20:41
-
-
Save merli129/7da0355604d5001ea0448d02e4bf420a to your computer and use it in GitHub Desktop.
Wordpress comment fields order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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