Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Gravityforms login form custom redirect if form not submitted

Once a user logs in, you’d want to check whether they’ve made a submission to your particular form. Gravity Forms keeps all of its entries (which is what it calls form submissions) stored away neatly, so we can simply check in there. If the user has no entries for your form, we’ll send them one way, and if they do, we’ll send them another.

For a bit of a nudge in the right coding direction: You might use the gform_user_registration_login_args filter to adjust the login redirect. Within that, you can use the GFAPI::get_entries function to check if the user has submitted a form. Here’s a super basic idea of what your function might look like in PHP code:

function custom_login_redirect( $login_args ) {
    // Get the current user info
    $current_user = wp_get_current_user();
    
    // Check for entries of form ID 2 (or whatever your form ID is) by the current user
    $search_criteria['field_filters'][] = array( 'key' => 'created_by', 'value' => $current_user->ID );
    $entries = GFAPI::get_entries( 2, $search_criteria );

    // If there are no entries...
    if( empty( $entries ) ) {
        // Redirect to Form 2
        $login_args['redirect'] = get_permalink( 123 ); // Your Form 2 page ID
    } else {
        // Redirect somewhere else
        $login_args['redirect'] = get_permalink( 456 ); // Another page ID
    }
    
    return $login_args;
}
add_filter( 'gform_user_registration_login_args', 'custom_login_redirect' );

A quick breakdown: we’re looking into the entries of Form 2 (or whatever your second form is) for submissions by the currently logging-in user. If we don’t find any, we send them to Form 2, and if we do find some, we send them elsewhere. Note that you’ll want to replace 123 and 456 with your actual Page IDs where your forms live.

Remember to have a thorough test to make sure it all works as you expect it to. Coding can be a bit of an adventure, sometimes! Also, crafting such a redirect might have some implications on the user experience, so perhaps a little notification to the user about why they are being redirected might be a warm little addition to smoothen their journey on your site.

Related Posts:

  1. Get selected values from checkboxes and radio buttons via Gravity Forms gform_after_submission hook [closed]
  2. Gravity Forms returns to odd position
  3. wp_set_password() does not work!
  4. Carrying information from button click into form [closed]
  5. Is it possible to set different payment gateway on each Gravity Forms form? [closed]
  6. Editing a text file from plugin menu
  7. Ajax Plugin Not Echoing Response
  8. Plugin that will output submitted form data for user? [closed]
  9. How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
  10. How do I add the same contact form to multiple wordpress sites and capture the response in one place or database?
  11. coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
  12. How retreive saved data from gravity forms in my template?
  13. Merge tags in multistep Gravity Form?
  14. Possibility to login without password
  15. Creating a form and displaying entry data as a table
  16. How can ι create my own (custom) WordPress table/list?
  17. Storing The Data Collected by Ninja Forms into Another (custom) Database [closed]
  18. WordPress Multi-Step Product Search
  19. JQuery needs to be defined in , but Gravity Forms is defining it in the
  20. Sell access to form [closed]
  21. File Uploader – Upload without adding to Media Library
  22. Custom form not showing in correct place on page
  23. add_meta_box creating default form field types
  24. Form Plugin for Api Requests which is used via Shortcode
  25. How to redirect to a page after the form is submitted
  26. Call another page in forms
  27. Echo out element to another page.
  28. How to Use the Filter “sidebar_login_widget_form_args”
  29. Select Form Element Not Saving from Plugin Options
  30. Storing Form data in a different database
  31. Is it save to replace with in WordPress search form
  32. Contact Form 7 Plugin emails not being received by some accounts
  33. Contact Form 7 “non-selectable” options in a drop down [closed]
  34. Using AJAX to run SQL statement and populate dropdown
  35. How to append new form elements in “Add New” form of Users in WordPress admin panel?
  36. Looking for a simple checkout plugin [closed]
  37. Redirect plugin after form submit or show errors
  38. Plugin for visitors to edit content without logging in? [closed]
  39. What’s the best way to echo out a filter variable?
  40. How do I send the contents of a form to deliver to the already existing custom field in the wordpress theme
  41. Linking form to user meta fields
  42. WordPress Forms Advance Conditional Logic
  43. get wpforms ID value from ACF text field
  44. how to resubmit a submitted form with gravity forms plugin
  45. User loggedin as Subscriber form not sending
  46. WordPress – send digital product with custom email
  47. GitHub plugins safe to use in my website?
  48. How to create a form where you can select multiple recipients, based on a list of website users?
  49. login form should redirect to register page for in 1st login next time it should redirected to home page
  50. WordPress search input in database, to edit information via form and update the database
  51. How to get data from a form on a wordpress site?
  52. WPForms Custom Redirect not working
  53. Submitting form to PHP
  54. How to capture hidden values with Gravity Forms
  55. How to use third-party SendGrid Email Validation API in Gravity Forms?
  56. General Term for this form Field
  57. Store GravityForm data in phpmyadmin (mysql)
  58. How can I implement radio buttons with icons in Contact form 7?
  59. Custom Formdata matching with user table
  60. Hide button after form submit and save state to localstorage
  61. Why is my form going to frontend on html form submission present on the php files inside my custom plugin?
  62. Meta Key array building with multiple input values from fields
  63. Creating posts with acf_form() that has a relationship type field
  64. Plugin to manage form submissions on admin panel
  65. How to send custom mail when a user complete a specific form
  66. How to submit custom form data using ajax to HubSpot form?
  67. Ajax call to php function doesn’t work PHP code
  68. Configuring default woo commerce login with modal popup
  69. submit form data to wordpress existing database table using my plugin
  70. Generating shortcode and HTML on button click
  71. Page takes on two different formats
  72. After form submission want to show success message in the form page
  73. get/show Last ID
  74. Pause form submissions while upgrading plugins
  75. How to hide the form after successful php execution
  76. How can I automatically send an email with an excel file containing submissions for a form rather than an email per submission?
  77. Why doesn’t a form need an ‘action’ with a plugin that uses the post data?
  78. $POST variable is empty in receiving php add-on function but can be seen by jscript function
  79. Authenticating custom field on login
  80. WP_Filesystem usage within a block of code
  81. I created a custom form in HTML/CSS and now I need it to submit … should I create custom PHP or is there a plugin I can use?
  82. Is there a function to search for a wildcard value when calling a shortcode?
  83. Include plugin form in the home page
  84. How can i see/log all requests coming from a registration form (not from the UI)?
  85. Redirect default login page to a custom page [duplicate]
  86. Form submit from wordpress plugin
  87. Create user assessment and use results in sql query
  88. Saving custom form fields
  89. How do I convince this button to do something when it is clicked?
  90. wordpress option page data from select form is not saving to database
  91. Linking Plugin Files to WP
  92. Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
  93. Create plugin with form in post and submit it to specific form
  94. Using a Cron Job to dynamically populate a field ONCE, and then making the field blank the next time someone visits page
  95. GravityForms to Salesforce API, problem with people who leave out company [closed]
  96. Link Forms on WordPress
  97. Custom Form only for admin
  98. Capturing POST data
  99. County Finder form/plugin?
  100. Creating fields in the database
Categories plugins Tags forms, plugin-gravity-forms, plugins, wp-login-form
Render link description in navigation block
Featured image on page is not displayed with certain theme: how to debug this?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress