I want to modify my MemberPress registration form field order. I want email to be at the top rather than down below the username field where it sits by default.
I’m using this code in my child theme’s functions.php file. It works, but it also duplicates the field on the form – now there are two email fields at the top – and I can’t figure out how to fix it:
<code>
```
function mepr_reorder_fields() {
?>
<script>
(function($) {
$(document).ready(function() {
var email = $('.mepr_email');
var firstname= $('.mepr_first_name');
if(email.length) {
email.insertBefore(firstname);
}
});
})(jQuery);
</script>
<?php
}
add_action( 'wp_head', 'mepr_reorder_fields' );
</code>
<code>
```
function mepr_reorder_fields() {
?>
<script>
(function($) {
$(document).ready(function() {
var email = $('.mepr_email');
var firstname= $('.mepr_first_name');
if(email.length) {
email.insertBefore(firstname);
}
});
})(jQuery);
</script>
<?php
}
add_action( 'wp_head', 'mepr_reorder_fields' );
</code>
```
function mepr_reorder_fields() {
?>
<script>
(function($) {
$(document).ready(function() {
var email = $('.mepr_email');
var firstname= $('.mepr_first_name');
if(email.length) {
email.insertBefore(firstname);
}
});
})(jQuery);
</script>
<?php
}
add_action( 'wp_head', 'mepr_reorder_fields' );
<code>
[Image of my form with two email fields at the top](https://i.sstatic.net/zOuzTvx5.png)
</code>
<code>
[Image of my form with two email fields at the top](https://i.sstatic.net/zOuzTvx5.png)
</code>
[Image of my form with two email fields at the top](https://i.sstatic.net/zOuzTvx5.png)
New contributor
Arista Witty is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.