Questions tagged [validation]

The tag has no usage guidance.

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

register_setting & add_settings_error validation issues with multiple fields

I've been trying to use the Settings API for the first time. I managed to piece together a working example but I'm stuck on how to make multiple input fields required. Right now I have an admin ...
0
votes
0answers
7 views

JS validation for multi-page caldera form

I have a multi-page Caldera form, for which I need to add some validation for the email address, checking it against an external site. The problem is, I can add this using Caldera Forms validation ...
0
votes
0answers
14 views

add_settings_error() not shown and settings validation not working (settings api)

I have an options page which is not added under the "settings" section, but via add_menu_page()/add_submenu_page() This page contains of html markup for my settings and at the end <div ...
1
vote
0answers
24 views

rest_sanitize_value_from_schema doesn't sanitize string

This is a part of a simplified piece of code. It accepts a JSON post, validates it against a schema and if ok, sanitize the JSON structure $schema = array( 'type' => 'object', ...
1
vote
0answers
9 views

How to remove role=“navigation” from all nav elements?

I did a W3C validation of my wordpress website and I got several warnings like this: The navigation role is unnecessary for element nav. r">↩ <nav role="navigation" class="...
1
vote
1answer
50 views

What is the proper way to validate and sanitize JSON response from REST API?

I have read the WordPress page about this but didn't find a solution. Here are my details: register rest route: register_rest_route( '/jwt-auth/v1', '/user', array( 'methods' ...
0
votes
1answer
34 views

Data Validation in wordpress

In my theme, i am grabbing user input with get_option() and according to that input i want to i want to declare a new variable and print in my single.php file. For example: <?php $...
0
votes
1answer
89 views

WordPress is creating nonce as a logged in user but verifying it incorrectly

I'm having trouble validating a nonce created with wp_create_nonce() inside a hidden input with the name nonce in an html form: <input type="hidden" name="nonce" value="<...
0
votes
1answer
67 views

$ is not defined [duplicate]

I am learning WordPress and I am working on the contact us form. I am using jQuery validation. I am using the below code. function contact($atts){ $html='<form name="invite" id="...
0
votes
0answers
52 views

What's the right way to validate JSON data coming from an AJAX POST request?

I'm building a little plugin with a send button: when clicked, the button calls (from the admin area) a rest api endpoint, passing JSON data through AJAX. Everything works very well and the callback ...
3
votes
1answer
465 views

How to define a query parameter with REST API?

I'm trying to define a GET REST API endpoint with register_rest_route register_rest_route supports defining a URL parameter and it is documented at https://developer.wordpress.org/rest-api/extending-...
0
votes
1answer
242 views

Change pubDate in rss feed in another format

In the default wordpress rss feed the element <pubDate> is <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> ...
0
votes
0answers
20 views

How to set ACF field as required

I have a text field "Author Name" in ACF on the post page and I want to set it as required. I tried setting it in ACF in the field options as required. It added the required attribute for the field in ...
0
votes
0answers
40 views

Required/Mandatory fields in WordPress Admin

Looking for a solution for WordPress Admin where fields such as Title, Excerpt, Category are required before being able to publish. Warning message or alert displaying what is missing because it is ...
0
votes
0answers
69 views

How to use third-party SendGrid Email Validation API in Gravity Forms?

Please let me know how to use SendGrid Email Validation API in Gravity Forms, using gform_field_validation filter? Gravity Forms filter example: add_filter( 'gform_field_validation', function ( $...
0
votes
0answers
21 views

Using built-in validation pop-up for custom fields

I am currently adding custom fields (by custom code) to the single product page in WooCommerce using the OceanWP theme. I was about to start custom validation to the fields when I noticed that the ...
1
vote
1answer
134 views

Is there a maximum length to user passwords?

In the database, the hashed password is stored in a field that can store up to 60 characters. My question: is there an upper character limit on the unhashed (user-chosen) passwords, or will the ...
1
vote
1answer
29 views

How to force field validation first, then its values saved durning edit profile?

I want to make validation of image during edit profile (wp-admin). My code for validation is: add_action( 'user_profile_update_errors', 'validate_steamid_field' , 10, 3); function ...
0
votes
0answers
60 views

Custom Registration and Updating Hidden Field After API Call

I created a custom registration form, one of the fields is being validated using a third party API. If the field passes validation later I update_user_meta. Currently if the field fails ...
0
votes
1answer
40 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
305 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 ...
1
vote
2answers
143 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 ...
1
vote
1answer
491 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" ...
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
43 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
1answer
335 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
85 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
27 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 ...
1
vote
1answer
2k 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
305 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
1answer
493 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
739 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
688 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
4k 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
1k 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
437 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', '...
8
votes
1answer
776 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;' ) );...
3
votes
1answer
1k 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
999 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
34 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
645 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
180 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 ...
4
votes
1answer
3k 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
2k 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
1k 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
330 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 ...
17
votes
12answers
48k 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 ...
0
votes
1answer
79 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'] != ''){ $...

1
2 3 4 5