Created
August 10, 2016 11:47
-
-
Save jnijstad/165ccded7fbaed2d5b980d7878a7976d to your computer and use it in GitHub Desktop.
Re-order the default fields in WordPress comment_form()
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 | |
| 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