Questions tagged [validation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
7 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
11 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
1answer
59 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
0answers
27 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
11 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 ...
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
0answers
14 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
69 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,...
0
votes
0answers
27 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
8 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
24 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
110 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
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
228 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
624 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
74 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 ...
0
votes
1answer
280 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
343 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 ...
1
vote
2answers
301 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 ...
6
votes
1answer
2k 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 ...
1
vote
0answers
895 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)....
2
votes
1answer
152 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
469 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;' ) );...
2
votes
1answer
732 views

Remove frameborder attribute from iframes

The W3C Validator outputs an error because Wordpress adds frameborder="0" to iframes. Also the Validator does not like the allow attribute. I found a similar question for Vimeo Videos: WordPress ...
2
votes
1answer
598 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
1answer
26 views

Do I have to have a nonce for a custom comment field?

im working on my comment section and I have added a custom field <input type="hidden" name="be_user_star_rating" id="be_user_star_rating" value="" /> Its value is beign set by Javascript. ...
-1
votes
1answer
480 views

WP Debug enabled Undefined index error in a widget

I have set WP debug to true, and I am getting error message → Notice: Undefined index: tick_the_snippet_type <p> <input type="radio" <?php checked( $instance[ '...
1
vote
0answers
130 views

wp_remote_post - handling responses

I need to add a form to my WordPress site that will post its data to an external API without ever storing the form data in the mysql database. I also need to show components of the response from the ...
0
votes
1answer
33 views

Is it necessary to do validation again when retrieving data from database?

I do validation when saving data to database like following: $data = validate($data); update_post_meta($post_id, 'my_post_meta', $data); The question is, do I need to do validation again when read ...
2
votes
1answer
1k views

WordPress REST API validation

I'd like to validate the data sent to my end point. https://www.shawnhooper.ca/2017/02/15/wp-rest-secrets-found-reading-core-code/ This post referenced the undocumented validation options. I have got ...
2
votes
0answers
2k views

Remove type attribute from script added by wp_localize_script

How can I remove type attributes from all scripts added by wp_localize_script ? Have the same problem with W3C validation as described here - Remove type attribute from script and style tags added by ...
0
votes
1answer
947 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 ...
0
votes
1answer
754 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 ...
4
votes
1answer
186 views

Shortcode putting html such as <img>

$atts = shortcode_atts( array( 'path' => 'https://s.w.org/about/images/logos/wordpress-logo-simplified-rgb.png' ), $atts); The above is a part of the shortcode. In Wordpress text ...
14
votes
12answers
38k 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
60 views

Passing form data on submit

In my sanitizing script, prior to using the POST Request method to submit this data, I have the following for my textarea input field named 'contact_msg': if($_POST['contact_msg'] != ''){ $...
0
votes
1answer
162 views

How to escape multiple attribute at once in WordPress?

I'm developing a WordPress theme and trying to escaping group of attribute at once that store with a variable. <?php $attributes = array(); $classes = array( 'header-section' ); if ( true == ...
0
votes
1answer
146 views

How WordPress sanitizes post content on save? Or it doesn't?

Does WordPress apply any kind of data sanitization for its post content when saving it from admin area? (like stripping <script> tags) Or all it does is checks for some user capability (like ...
0
votes
1answer
342 views

How do I sanitize the str_replace function in javascript variables

I have the following code in the javascript which outputs the date(s). With backslash for that, I'm replacing those strings with the str_replace to remove backslash, but I can't sanitize that using ...
0
votes
0answers
59 views

Form Sanitization and Validation

Already asked this on Code Review but no answer there so that's why i'm trying here. I'm kinda new to form sanitization and validation. If someone could look at my code and tell me where i could do ...
-1
votes
1answer
615 views

How to use esc_attr__() function properly to translate a variable that contains string?

I am trying to develop a theme and trying to escape a string using esc_attr__() fuction. Here is how I implemented it. $title = stoic_get_the_site_title(); echo esc_attr__($title, 'stoic'); But ...
2
votes
1answer
377 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'] ) ); ...
-1
votes
1answer
9k views

How to do Conact form 7 name field validation? [closed]

I am using contact-form-7 plugin, where i have created name field as Name. The name field is accepting text and number too. But my requirement is that name field should not start from number so how i ...
4
votes
1answer
516 views

edit profile validation refreshes all field if missing wordpress

In the edit profile section whenever I'm updating a field and if for example I've missed one required field (NickName) and changed the email address to a new one, the WordPress validation will ...
0
votes
0answers
2k views

Contact Form 7: Make field required after checkbox is checked

I have a telephone field in Contact Form 7 as follows: [tel Phone id:Phone] and a checkbox that for users to optionally choose to be called back: [checkbox Callback id:Callback "Rückruf gewünscht"] ...
0
votes
2answers
2k views

Sanitizing text fields in array

I tried this code to create some meta boxes is all working fine, the problem I am facing is how to sanitize the text fields and update post meta function Print_price_fileds($cnt, $p = null) { ...
1
vote
1answer
230 views

Permit Login if table row exists

I am using the "authenticate" filter hook within the WordPress codex to adjust the validation script of the WordPress Login page. What I need to do is create a query to a separate table to see if ...