Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Disable the first name and last name fields in the personal question group in registration checkout for Event Espresso 4

This sample coding can be added to your child theme’s functions.php file (do not include the opening php tag) or a site specific plugin:

123 should be changed to your page ID of your actual registration checkout page. This can be found by going to your WP dashboard and clicking on the registration checkout WordPress page. The ID appears at the end of the URL.

For example, if the ID for your registration checkout page was 1357, then you should use that value in the sample coding instead of 123.

Add the sample code below to your child theme's functions.php file or in a site specific plugin.

//* Do NOT include the opening php tag
//* Disable the first name and last name fields during registration checkout
function ee_disable_name_fields_registration_checkout() {
      if ( is_page( 123 ) ) {
        jQuery(document).ready( function($) {
          jQuery("input[id$=-fname]").prop( "readonly", true );
          jQuery("input[id$=-lname]").prop( "readonly", true );
add_action('wp_footer', 'ee_disable_name_fields_registration_checkout');

This comment has been minimized.

Copy link

@Apina Apina commented Apr 6, 2015

Note, if you are having issues with validation, try readonly instead of disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment