Questions tagged [validation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
16 views

How to save Checkbox-Options in Plugin Options Page

First of all: I am really a newbie. So I used a template for my options page and tried to customize it (works pretty good so far). About my plugin: It creates to post types and some meta boxes ...
0
votes
0answers
8 views

Log validation information

When updating a post I get the following error message. Validation failed. 1 field requires attention I cannot deduce from the user interface which field requires attention. The field may not be ...
0
votes
1answer
721 views

Allow users to register on multisite through WooCommerce using the same email address

I'm working on setting up a multisite environment, and have run into the possibility of a user trying to register on the sub-site with the same email address they've used on the main site. I've found ...
7
votes
6answers
19k views

How to check if a string is a valid URL

WordPress provides a helpful function called is_email() which checks if a given email address is valid. Is there a similar function available to check if a URL is valid? I tried is_url() but that was ...
0
votes
1answer
29 views

WooCommerce fails to apply validation to checkbox input

A WooCommerce site is being used to accept player registrations for a sports program. To register, a child's guardian must fill out certain fields and also agree to terms. The fields that need to be ...
0
votes
1answer
888 views

Restrict user registration to emails on a single domain

I need to allow user registrations only for those with email addresses on a single domain. I have tested multiple regular expressions and this one works well in a regex sandbox environment, but as ...
0
votes
2answers
20 views

How to validate custom fields for a custom post type before insert?

I'd like to know how to validate custom fields and return error notice (if necessary) before a custom post type is inserted into the database. After a little research I found one similar question ...
0
votes
0answers
16 views

Move form validation error messages to top of page

When a user registers on our site (using Ultimate Member plugin, but I think it's a generic issue) and the form doesn't validate, it reloads the page with an error message right down the bottom, where ...
1
vote
2answers
1k views

How to retain the values from dropdown category lists after wrong form submission?

I can't figure out the the code for - How to retain the values from dropdown category lists after wrong form submission? Any suggesstions, thanx in advance. <select class="selectpicker btn-block" ...
1
vote
1answer
433 views

Unable to sanitize in customizer and escape in theme without removing ability for user to use “< br >” to insert a line break

I have been unable to figure out how I can properly sanitize (in the customizer) and escape (in the theme, while allowing the user to use "<" and ">" to insert a '< br >' and add a line break ...
14
votes
12answers
39k views

Remove type attribute from script and style tags added by WordPress

Warning: The type attribute is unnecessary for JavaScript resources. From line 10, column 146; to line 10, column 176 feed/" /> <script type="text/javascript">window Warning: The ...
0
votes
1answer
802 views

Add file upload with validation to custom form

I have a custom contact form page that I am trying to add an upload field that validates filesize and filetype. Before adding the validation everything worked. <?php /* Template ...
0
votes
1answer
433 views

Proper Way to Sanitize Meta Input

I have a meta field which gets displaed in the admin panel look like: $field = get_post_meta($postid, 'field_name', true); ?> <input type="text" name="field_name" value="<?php echo (!empty($...
6
votes
4answers
13k views

How to validate custom fields in custom post type?

I wrote a plugin that creates a custom post type with custom fields. To prevent users from entering incorrect information, how can I validate the data? I assumed that the save_post hook function ...
0
votes
1answer
1k views

Jquery Validation Engine with Conatct Form 7

I am using contact form 7 and it's working with basic validations. But i have to do some advanced validation. So i have to use https://github.com/posabsolute/jQuery-Validation-Engine. How can i use ...
1
vote
1answer
89 views

Form validation in WordPress Admin Panel

I am developing a WordPress plugin. In this regard I am gathering data from User using a Form via Wordpress Admin Panel. My code is like below <form method="post" name="newAddress" id="newAddress" ...
0
votes
1answer
488 views

Gravity Forms validate arrival and departure

I am working recently with GF and encounter the first problem: I have two datepicker; one is "arrival" and one is "departure". Now - of course - the "departure" can't be before "arrival". I've found ...
0
votes
2answers
664 views

Best Practice for Validating and Sanitizing Data

I developed a plugin which processes data following user input into a number of forms on the front end. The field types within the forms and the data input varies significantly. To process the data, ...
6
votes
1answer
3k views

Validation error: Extending Gutenberg gallery block

I am trying to extend the Gutenberg core/gallery block to add some new functionality to my image gallery on the frontend. I have created a separate plugin to handle this task. I have registered my ...
0
votes
0answers
38 views

Changing the “Post Published. View Post” admin notice message after running `wp_insert_post_data` filter

I am running a validation logic for when a user is attempting to publish a post, the validation is made possible using wp_insert_post_data filter. If a user wish to publish a post, the filter will ...
0
votes
0answers
12 views

How to insert input field on post and validate in PHP using button?

I have the plugin PHP Everywhere activated in my Wordpress installation. I've figured out how to get PHP scripts running on page load (viewing a post) using a Gutenberg Block but now I'd like to run ...
1
vote
0answers
12 views

Shrink down register_settings on Settings API

Instead of having so many function calls, is there a way that I can have one function call and all the fields under one section and then just call one section on the form? /** * Register each ...
7
votes
1answer
523 views

Check for and enforce unique value in user-entered custom meta field in WP Admin

I am trying to figure out how, on a new or edit post screen, to allow the user to enter a custom meta-item, BUT force it to be unique. Ideally, the process would work like so: Contributor logs into ...
2
votes
1answer
2k views

Sanitizing and validating email field

Should I use is_email() to validate an email field? In WP. I've put the email field in a widget. I would really appreciate some help. function update($new_instance, $old_instance) { $instance = $...
0
votes
1answer
34 views

confused about sanitize_email after is_email [duplicate]

Assume I have checked an email using is_email and the result is true, should I sanitize with sanitize_email? if yes, then why?
0
votes
2answers
425 views

Filter and validate user role in registration

I want to show a select box for user roles in the registration form. I am using this model: /* ROLES IN LIST REGISTRATION */ // 1. Add a new form element... add_action( 'register_form', '...
0
votes
0answers
15 views

jQuery Validation plugin with AJAX and PHP Superglobals strange behavior

I wrote a HTML form in a WordPress template and I want to validate it with jQuery Validation plugin but I have problem with AJAX validation, this is an extraction of what I wrote: add_action( '...
0
votes
1answer
96 views

jQuery Validation plugin and Bootstrap 4 CSS classes

I'm using jQuery Validation plugin to validate a WordPress theme form. I'm using also Bootstrap 4 so I'd integrate the Bootstrap validation classes ("is-valid" and "is-invalid") with Validation plugin,...
2
votes
1answer
405 views

Validation Function for URL in plugin

if ( cpmb_is_valid_mp3( $_FILES['video-url']['name'] ) ) { $response = wp_upload_bits( $_FILES['video-url']['name'], null, file_get_contents( $_FILES['video-url']['tmp_name'] ) ); ...
0
votes
0answers
31 views

Stop/Error on pre_post_update

I'm trying to check for errors in page updates, I guessed that pre_post_update would be a suitable place.... I have it throwing errors for me in the frontend, but I'm unable to get it to acctually ...
0
votes
0answers
10 views

how to find only more then 1 value in array if $_POST['data'] is post 5 or more array length if value found then stop cheking & return true

how to I check only which value is in database, I mean i have array of 4 but in database only two values and i post 2 value from array and other field blank or array if these two values found in array ...
0
votes
0answers
26 views

how to add security questions on wp-registration page and validate it

I wanted to validate security questions which show's on wp-login page validation is if answers are blank user cant login and if user register with 2 questions and admin change no. question show on ...
0
votes
0answers
19 views

Post title value with colon causing search issues

Hoping someone can help shed some light here... I have the following titles: Icons & Innovators: Norman Lear Muslim/American: Halal 44 Charlton: Pride I am using the native WP search. The ...
0
votes
0answers
129 views

Custom jQuery not triggered/working after gravity form default validation error message gets displayed

I am adding custom jQuery to display certain fields on the basis of conditional logic. For eg: When a "Business Type" field value is selected as Company, "Company Name" and "Company Website" fields ...
0
votes
0answers
21 views

Data Validation & Sanitization for Big HTML Blocks

I'm developing a theme for Envato. Got Soft Reject because of issue typed in the question title. I created a 4 column widget area for my theme's footer. How can I sanitize the $output variable? Thank ...
0
votes
1answer
1k views

jQuery Live Form Validation in Wordpress

I'm trying to implement the form validation that can be found at: http://www.geektantra.com/2009/09/jquery-live-form-validation/ I can get the demo above working, but when I implement it on my ...
0
votes
0answers
11 views

How to implement required input validation?

In Wordpress, the add-new-user page, for example, has some jQuery validation to make sure that the username isn't empty. It provides with visual feedback like the following: I'm working on a custom ...
0
votes
0answers
246 views

Contact Form 7 require one of two fields

I have form fields: <label>[email email-313 placeholder "e-mail address"]</label> <label>[tel tel-466 placeholder "phone number"]</label> [submit "Zapisz się"] How can I ...
1
vote
1answer
710 views

Wordpress-gutenberg - Block validation: Expected text

I am building a gutenberg block plugin and I got stuck on simple two-field structure. The issue is that the save function works properly but something is wrong with the edit function. When I reload ...
0
votes
1answer
86 views

Using $wpdb | checking entered email against existing emails in db

Without ranting too much, here is my snippet: if (empty($_POST["email"])) { $emailErr = "Email is required"; } else { $email = test_input($_POST["email"]); // check if e-mail address is ...
1
vote
2answers
2k views

I would like to password protect my entire Wordpress site (ip validated), except for one page

I am currently using the .htaccess file in cPanel to password protect my Wordpress website. There are a list of whitelisted IP addresses that can bypass the login form. I would like to whitelist a ...
0
votes
2answers
14k views

Conditional required fields for Wordpress Contact Form 7

I know this might be considered off topic but I am not sure where else to post this as it also pertains to WordPress as well as the plugin Contact Form 7. If you know where I should post this other ...
0
votes
1answer
298 views

Validate custom fields before save using WordPress Rest API

I want to add custom validation to post(custom post type) before it save into the WordPress. I am using the Rest API to insert the post to custom post type. What I need is the fields which I created ...
1
vote
1answer
386 views

wooCommerce checkout page State / County (optional) validate not working

wooCommerce checkout page State / County (optional) validate not working that is my added code add_filter(‘thwcfd_State_field_override_required’,’__return_true’); any idea for how to add ...
2
votes
1answer
628 views

Error in Validate Field with ACF plugin in Wordpress

I have the following problem when I am validating a field with the Advanced Custom Fields plugin in wordpress. What happens is that the field is validated correctly but the error appears on a new page ...
1
vote
2answers
349 views

Assignments must be the first block of code on a line Validation Error on Travis

Travis is giving me ~ Assignments must be the first block of code on a line for this specific line of code: $validate_string = $pf_param_string = substr( $pf_param_string, 0, - 1 ); It seems fine ...
1
vote
0answers
960 views

jquery.validation.js is not working in woocommerce checkout page form

jQuery("#woocommerce_checkout_form").validate({ highlight: function(element) { (jQuery(element).parent()).parent().addClass("woocommerce-invalid"); (jQuery(element)....
12
votes
4answers
15k views

don't publish custom post type post if a meta data field isn't valid

I have a custom post type (CPT) called event. I have a meta box for the type with several fields. I would like to validate some fields before publishing an event. For example, if an event's date is ...
2
votes
1answer
163 views

Stop the form of beign submitted on “Save changes” custom option page

Using the Settings API of Wordpress i want to try cancel the submission of the options when the validation/sanitization fails. Registering the settings: register_setting( 'mysettingspage', '...
7
votes
1answer
503 views

Sanitize and data validation with apply_filters() function

Should we sanitize and validate the apply_filters() like the examples below? absint( apply_filters( 'slug_excerpt_length', 35 ) ); wp_kses_post( apply_filters( 'slug_excerpt_more', '&hellip;' ) );...

1 2 3 4 5