Contact Form 7 - Pre-Fill Fields for Logged-In Users
Use the default: option in Contact Form 7 tags to fill a form's name, phone and email fields from the logged-in user's profile — and see what your options are for visitors who are not logged in.
2 minute read
Contact Form 7 supports dynamic default values for logged-in users through the default: option in form tags. This is particularly useful when you want to fill in user details such as name, email, or phone number automatically, based on the currently logged-in user's profile.
Examples
[text* your-name placeholder default:user_display_name]
[tel your-phone placeholder default:user_phone]
[email* your-email placeholder default:user_email]
These tags behave as follows:
- If the user is logged in, the field is pre-filled using their profile data.
default:user_display_name– uses the user's display name.default:user_phone– uses theuser_phonemeta.default:user_email– uses the user's email address.- If the user is not logged in, the default value remains empty.
A fallback for visitors who are not logged in
If you want to provide a fallback value for non-logged-in users — showing “Your name” when nobody is logged in, for instance — this is not directly supported within a single shortcode. You cannot combine default: with a static fallback value conditionally.
There are two possible workarounds:
- Create two separate forms – one for logged-in users and one for guests – and display them conditionally using shortcodes or theme logic.
- Add custom labels above the fields instead of relying solely on placeholder values.
Ask the people who build Listivo
We answer by email from support@tangiblewp.com. With Premium Support, we also fix your site when something breaks.
We can also run your site for you, or build a new one.
Was this guide helpful?