Questions tagged [validation]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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
235 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 ...
0
votes
2answers
3k views

Make post_content and other custom fields required

What's the best way to set the required atribute on html forms in wordpress, for instance I would like post-content to be required, so this code need to be changed: <textarea class="wp-editor-area"...
0
votes
1answer
589 views

Required radio button does not validate in form, when clicked through Javascript/jQuery

I have a radio button that selects a dealer in my checkout. I need this button to automatically be checked for the user - however, no matter what I do, the radio button still needs to be clicked to ...
0
votes
0answers
46 views

Validating Error with submit button

I really need your help.. I am tryin like 3 days now to change the first pic and make it like the 3rd one. I did it but when Iremove depoarture day the enquire button doesnt work and dont get the form(...
0
votes
1answer
389 views

Custom HTML form using PHP - help with ajax/username validation

I currently have a working registration form I created on my page. It's an HTML form and I coded PHP to have it create the user in our WP_user table and email us with info from the form. The PHP is in ...
0
votes
1answer
718 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 ...
1
vote
2answers
28 views

What esc_ to use to validate this?

I tired esc_url but it doesn't work. if ( $power_by ) { ?> <div class="sponsor-credits"> <span class="sponsor-credits__label">Powered by </span> ...
1
vote
1answer
118 views

Prevent invalid or empty values from being saved to the database and retain the form field values upon error

I'm using the Settings API to save the settings of my plugin. I want a positive integer value from the settings field. register_setting( $option_group, $option_name . '_number', '...
-1
votes
1answer
2k views

Custom Registration and Login Forms with reCaptcha 2 Validation

I've read all the posts at stackoverflow and wordpress stackexchange, and none of the topics on using Google reCaptcha 2 have given me information on how to validate reCaptcha on both custom wordpress ...
1
vote
1answer
148 views

Does balanceTags() provide any escaping / protection?

I'm just getting into WordPress and keep seeing sample code with balanceTags() used when echoing out a variable. Am I right in thinking it does nothing in terms of output validation? Thank you
1
vote
1answer
70 views

Who is responsible for data sanitization in WordPress development?

I am studying how to write more secure WordPress code by implementing validation, sanitization and data escaping wherever necessary. Validation and escaping makes perfect sense, but I am a little ...
0
votes
2answers
658 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, ...
0
votes
1answer
48 views

Restrict certain roles registrations by domain

I'm really stumped on this one. I have figured out how allow registration from certain email domains. However, I only want to restrict one user type. For example 'ROLE1' can register with any email ...
0
votes
1answer
168 views

media_handle_upload on mix form fields (not required file input)

I collaborate with the development of the theme Odin Framework, which has several classes that leverage the launch of a site from scratch. Among them, we have the abstract-front-end-form.php (link to ...
4
votes
2answers
219 views

What is the best practice for escaping data URIs?

Usually, you would use esc_url() to escape a URL before displaying it. If that 'URL' is a data URI (eg. 'data:image/svg+xml;base64,...'), it will be trimmed blank by esc_url(). The Codex page on Data ...
0
votes
1answer
714 views

Require user to input code from an array of allowed codes with Gravity Forms [closed]

I have a gravity form that I want to, only allow people submit if they enter a specific code from a possible list of 3. Example codes XH6D 8U2A L9D3 If a user enters XH6D into the form, the form ...
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
1answer
195 views

WordPress login form with fancybox

I'm using fancybox to show WordPress login form. It works perfectly. However, if the user enters incorrect user name or password, he is redirected to wp-login.php, but I want the validation will take ...
0
votes
1answer
21 views

Help with Wordpress RSS Validation Error

I was trying to link my site (http://neontoday.com) to Bloglovin. However it wasn't showing my post, so I emailed support and I was told there was an issue with RSS validation for my site. I have ...
0
votes
1answer
887 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
1answer
617 views

How to validate custom field on lost password form before the user id field?

I have added a custom field to the lost password form (using the action lostpassword_form) and I am validating this field with the filter allow_password_reset. It is working but I want my field to ...
0
votes
1answer
950 views

jQuery plugin not loading

I am trying to use the below function to enquue 2 scripts (one internal, one external). The internal one ('custom_script') is working, but the 2nd one ('formValidation') isn't (I get a 'validate() is ...
1
vote
0answers
24 views

Validate post checking if child term is assigned

For this particular case, all posts had to be a child term assigned to be published. I'm trying to hook on the "save_post" action, check the terms, return an error message if no child term is ...
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
80 views

Calling JavaScript file with Custom Plugin

So, the goal is to use jQuery Validation for a custom form. Maybe I'm going about this the hard way. But, here's what I'm doing: Uploaded the jQuery Validation file to my theme folder Created plug-in ...
0
votes
2answers
422 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', '...
1
vote
0answers
160 views

What data validation we must use in different contexts?

Recently, my theme got rejected on Themeforest and one of the rejection issue is: Data Validation issues have been found in your theme. All dynamic data must be correctly escaped for the context ...
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
1answer
158 views

Plugin option for input box validation

I'm crating a plugin option page from the code below. However, it does not explain how to get validation on the input fields. How do I get validation on id_number for NUMBER ONLY? https://codex....
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 ...
0
votes
2answers
1k views

How to add HTML5 required on wp_editor

I want to add HTML5 required for the client side validation on textarea generated by <?php $content = ''; $editor_id = 'YOURID'; wp_editor( $content, $editor_id ); ?> What is the ...
0
votes
0answers
19 views

How to format the various types of custom fields?

So i am ready to throw in my custom post type a bunch of custom fields. All these fields need specific handling for their input and validation. Exmaples: Numeric fields E-mails WYSIWYG editor ...
1
vote
1answer
3k views

Validate form in functions.php, send errors back to template

I have a form in a template that upon submission should be validated, and any errors should be displayed, and if no errors, insert the data into the database. I'm new to wordpress, but my idea was ...
0
votes
1answer
4k views

Disable woocommerce PLACE ORDER button if user selected products that are not available for international delivery

In my woocommerce site, I list both products that are available for shipping to India as well as International destinations. Am assigning a only-india shipping class to certain products so as to mark ...
0
votes
1answer
3k views

How to bypass Woocommerce checkout validation from the plugin? [closed]

I need to bypass any validation process in Woocommerce checkout page when Process Order button clicked. What filter or action hooks should I use?
0
votes
0answers
196 views

Why is my script's regex having its backslash removed?

One of my company's child themes requires customization. I am customizing using jQuery and have noticed in my function's regex (function lives in the "scripts" section of "Pages"--->My Page) that ...
2
votes
3answers
4k views

How to Remove novalidate attribute from comment form

I'm using html5 support for input formats and custom comment form fields with this code: <?php $commenter = wp_get_current_commenter(); $args = wp_parse_args( $args ); if (...
0
votes
0answers
804 views

Displaying errors on the front end from my plugin

I am creating a plugin that has a frontend form, which in turn has some validation.. Errors if validation fails and success if it passes. I have tried everything and can't get messages to appear on ...
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 ...
1
vote
2answers
294 views

Show the submitted values in the form when validation fails

Currently I do: $options = get_option( 'jons-plugin-options' ); echo "<input id='jons-plugin-options[field-two]' name='jons-plugin-options[field-two]' size='4' type='text' value='" . $...
2
votes
1answer
375 views

Data Validation: Always escape late / escape HTML Code

I uploaded a Theme at THE marketplace and got soft rejected because I should "always escape late" I am not sure how to solve this other than I did. I have multiple if statements where HTML is saved ...
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($...
0
votes
1answer
74 views

Why the WP Core team does not allow filter_* functions? [closed]

This question is somehow related to this other question. Provided that is seems we have a solution for the magic quotes issues, why the WP Core team does not allow them? This is unclear to me and I ...
1
vote
1answer
1k views

How to use the built in tooltip for form validation error messages in WP admin plugin?

I'm building a wordpress plugin that includes serveral menus in the wordpress backend (admin). I'd like to use as many existing parts as possible and make my menus look like the standard wordpress ...
0
votes
1answer
248 views

Remove comments validation (remove filter?)

How i can remove wordpress comments content validation, I do not want to or examined the earlier there was no such comments. I see for: http://codex.wordpress.org/Function_Reference/...
3
votes
1answer
760 views

WordPress oEmbed W3C Validation

I recently built a theme that utilises the oEmbed feature in WordPress. Where possible, I like my themes to validate via W3C. The content of the website is driven by Vimeo videos, so I'm getting ...
0
votes
1answer
93 views

Warn user that data may be lost for custom pages

When you edit a builtin field in Wordpress like the title and don't save the cahnges, and attempt to go to another link, a warning alert box comes up stating that "changes may be lost if you navigate ....
0
votes
0answers
32 views

Validation Always Tells There Is an Open DIV

The Validator will just not accept my website and is always telling me, there are two errors: 1. an open DIV ("inhalt") 2. an article left ... and I just can not find the errors in the index.php. ...