The after_signup_form WordPress action allows you to run custom code after the sign-up forms, before the wp_footer is called.
Usage
add_action('after_signup_form', 'your_custom_function');
function your_custom_function() {
// your custom code here
}
Parameters
- None
More information
See WordPress Developer Resources: after_signup_form
Examples
Display a thank you message after sign-up form
Display a simple thank you message to users after they complete the sign-up form.
add_action('after_signup_form', 'display_thank_you_message');
function display_thank_you_message() {
echo 'Thank you for signing up!';
}
Load a custom JavaScript file after sign-up form
Enqueue a custom JavaScript file after the sign-up form.
add_action('after_signup_form', 'load_custom_js');
function load_custom_js() {
wp_enqueue_script('custom-script', 'path/to/your-script.js', array('jquery'), '1.0', true);
}
Display a privacy policy link after sign-up form
Add a link to your website’s privacy policy after the sign-up form.
add_action('after_signup_form', 'display_privacy_policy_link');
function display_privacy_policy_link() {
echo '<a href="/privacy-policy/">Privacy Policy</a>';
}
Display social media icons after sign-up form
Show social media icons after the sign-up form to encourage users to connect with your brand.
add_action('after_signup_form', 'display_social_media_icons');
function display_social_media_icons() {
// Replace '#' with your social media profile URLs
echo '<a href="#"><i class="fab fa-facebook"></i></a> ';
echo '<a href="#"><i class="fab fa-twitter"></i></a> ';
echo '<a href="#"><i class="fab fa-instagram"></i></a> ';
}
Add a newsletter sign-up checkbox after sign-up form
Include a checkbox for users to opt-in to your newsletter while signing up.
add_action('after_signup_form', 'add_newsletter_signup_checkbox');
function add_newsletter_signup_checkbox() {
echo '<label for="newsletter_signup">';
echo '<input type="checkbox" name="newsletter_signup" id="newsletter_signup" value="1" /> ';
echo 'Sign me up for the newsletter!</label>';
}