Title: Forms not submitted
Last modified: October 3, 2025

---

# Forms not submitted

 *  Resolved [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/forms-not-submitted/)
 * I have a strange situation where what were working forms are not now being submitted.
   This is occurring when I add some extra code to functions.php in the theme. The
   intention of the code is to restrict access to the toolbar/dashboard for some
   types of users so I cannot see how it might affect form submission. I made a 
   test site with the same theme and your plugin and it works correctly.
 * So, it might be some interelationship with another plugin but that seems less
   likely given the forms work until that extra code is added.
 * I am struggling to understand and wonder if you might have any suggestions, or
   whether there are any tests you can suggest? Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Ralden Souza](https://wordpress.org/support/users/rsouzaam/)
 * (@rsouzaam)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/forms-not-submitted/#post-18669540)
 * Hi [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * Thanks for reaching out! I’m sorry to hear about the issue with submitting the
   form.
 * Could you please share your extra code when you have a chance? That will help
   me try to reproduce the issue and provide more information.
 * Thanks, and please let me know!
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/forms-not-submitted/#post-18669623)
 * This is the code…
 *     ```wp-block-code
       //Extra testcode to restrict access// Restrict WordPress admin panel access to specific user rolesfunction wp_dudecom_restrict_admin_access() {    // Check if the current user is trying to access the admin panel    if (is_admin()) {        // Get the current user's role        $user = wp_get_current_user();        $allowed_roles = array('administrator', 'editor'); // Define roles that are allowed access        // Check if the user has one of the allowed roles        if (!array_intersect($allowed_roles, $user->roles)) {            // Redirect users without the allowed roles to the homepage            wp_redirect(home_url());            exit;        }    }}add_action('admin_init', 'wp_dudecom_restrict_admin_access');// Ensure that users without access cannot see the admin barfunction wp_dudecom_hide_admin_bar_for_non_admins() {    // Get the current user's role    $user = wp_get_current_user();    $allowed_roles = array('administrator', 'editor'); // Define roles that are allowed to see the admin bar    // Hide the admin bar for users without the allowed roles    if (!array_intersect($allowed_roles, $user->roles)) {          add_filter('show_admin_bar', '__return_false');    }}add_action('after_setup_theme', 'wp_dudecom_hide_admin_bar_for_non_admins');?>
       ```
   
 *  Plugin Support [Ralden Souza](https://wordpress.org/support/users/rsouzaam/)
 * (@rsouzaam)
 * [8 months, 1 week ago](https://wordpress.org/support/topic/forms-not-submitted/#post-18671197)
 * Hi [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * Thanks for sharing the code!
 * I tried it with the WPCode Lite plugin, as well as with the WPForms Lite, WP 
   Mail SMTP Lite, and Twenty Twenty-Five themes on my test site. I had no issues
   submitting my forms.
 * The problem may be a conflict with another plugin or your theme. When you get
   the chance, could you please try using the steps in WPBeginner’s detailed guide
   on [troubleshooting WordPress](https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/)
   to see if it helps resolve the issue?
 * Thanks!
 *  Plugin Support [Ralden Souza](https://wordpress.org/support/users/rsouzaam/)
 * (@rsouzaam)
 * [8 months ago](https://wordpress.org/support/topic/forms-not-submitted/#post-18674449)
 * Hi [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * We haven’t heard back from you in a few days, so I’m going to go ahead and close
   this thread for now. But if you’d like us to assist further, please feel welcome
   to continue the conversation.
 * Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Forms not submitted’ is closed to new replies.

 * ![](https://ps.w.org/wpforms-lite/assets/icon.svg?rev=3254748)
 * [WPForms - Easy Form Builder for WordPress - Contact Forms, Payment Forms, Surveys, & More](https://wordpress.org/plugins/wpforms-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpforms-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpforms-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/wpforms-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpforms-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpforms-lite/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Ralden Souza](https://wordpress.org/support/users/rsouzaam/)
 * Last activity: [8 months ago](https://wordpress.org/support/topic/forms-not-submitted/#post-18674449)
 * Status: resolved