Title: Stop validation on edit page
Last modified: August 21, 2016

---

# Stop validation on edit page

 *  Resolved [polr](https://wordpress.org/support/users/polr/)
 * (@polr)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/)
 * Hello,
 * I’ve found the code below to stop the plugin from validation in the admin area
   if (!is_object(self::$validation_errors) and ! is_admin())
 * but I need it to stop validation when a user clicks Edit Record from the frontend
   along with on the admin area, I have tried both of the following and can’t get
   it to work
 * if (!is_object(self::$validation_errors) and ! is_page(206))
 * if (!is_object(self::$validation_errors) and (! is_admin() || ! is_page(206)))
 * That’s definitely the page id and I’ve tried with page name etc to double check
   but nothing works. Can you tell me if this is possible and an idea of how to 
   do it?
 * Thank you
 * [http://wordpress.org/plugins/participants-database/](http://wordpress.org/plugins/participants-database/)

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

 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/#post-4173297)
 * I don’t know why you need to suspend validation on the frontend, but you could
   just disable validation on those fields you don’t need it on…
 *  Thread Starter [polr](https://wordpress.org/support/users/polr/)
 * (@polr)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/#post-4173310)
 * I know it seems illogical but it’s what’s required. They need to be inputting
   information on two different forms (with only about 50% similar fields) that 
   needs to be validated (there’s been a lot of customisation) then on the edit 
   page it pulls over all fields from all form fields so some of the fields are 
   required at the edit when they don’t apply.
 * It was either that or I needed to be able to create two different/tailored pdb_single
   pages but I couldn’t see how to do that (well, I couldn’t see how to specify 
   different pdb_single pages were used per form as it’s set once in the admin settings)
   so this would be a rougher alternative that would allow edits to go through.
 * From the code I supplied to begin with, can you see if there is any obvious reason
   why this wouldn’t work?
 * Thanks
 *  Plugin Author [Roland Barker](https://wordpress.org/support/users/xnau/)
 * (@xnau)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/#post-4173315)
 * Well, at the point where this test is taking place, the post object has not been
   instantiated. So, WP doesn’t know which page it is yet. Without digging deeper,
   I’d say you need to test the server variable against the page name:
 * `$_SERVER['REQUEST_URI'] != "/page-name/"`
 * Where ‘page-name’ is the slug of your page. You could also use a “strpos” test
   if the end slash isn’t always there.
 *  Thread Starter [polr](https://wordpress.org/support/users/polr/)
 * (@polr)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/#post-4173430)
 * Hi,
 * Thanks for that, just in case anyone should ever need it (and yes, I’m not sure
   why either) my solution was to do this in participants-database.php at line 1808:
 * $post_id = (206);
    $post = get_post($post_id); $slug = $post->post_name;
 * if (!is_object(self::$validation_errors) and ! is_admin() and !strpos($_SERVER[‘
   REQUEST_URI’], $slug))
    self::$validation_errors = new FormValidation();

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

The topic ‘Stop validation on edit page’ is closed to new replies.

 * ![](https://ps.w.org/participants-database/assets/icon-256x256.jpg?rev=1389807)
 * [Participants Database](https://wordpress.org/plugins/participants-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/participants-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/participants-database/)
 * [Active Topics](https://wordpress.org/support/plugin/participants-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/participants-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/participants-database/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [polr](https://wordpress.org/support/users/polr/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/stop-validation-on-edit-page/#post-4173430)
 * Status: resolved