The validation tag has no wiki summary.
12
votes
2answers
335 views
In Which Contexts are Plugins Responsible for Data Validation/Sanitization?
I want to make sure all of the data in my plugins/themes is handled securely before entering the database and before being output to the browser. My problem is that there are situations where the API ...
6
votes
3answers
3k views
Sample code for validating custom metabox?
I've found very little on this site or in Google searches for examples of validating metabox custom fields.
If anyone wants to give examples, here are some cases that would be useful
1) Date entered ...
5
votes
2answers
151 views
Require featured image
I would like to require a featured image on a site I am developing.
I tried the code here: Make featured image required and nothing happened - the JS showed up in the site header, but I could still ...
4
votes
4answers
328 views
Replacing the Wordpress password validation
I have a custom application with thousands of users who already have a password stored. I would like to set up a self hosted wordpress site to accompany that application and to use the usernames and ...
4
votes
3answers
2k 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 ...
4
votes
3answers
846 views
How should one implement add_settings_error on custom menu pages?
The Professional WordPress Plugin Development book explains in detail how to properly use the Settings API, and it also demonstrates how to add Menus and Submenus, but unfortunately it doesn't provide ...
3
votes
1answer
808 views
Does wp_insert_post validate the input?
If I use the wp_insert_post in a plugin, will I have to check the content for SQL injection problems and XSS or will the wp_insert_post function do this for me?
3
votes
2answers
802 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 ...
2
votes
2answers
249 views
Data Validation
I'm using Wordpress as CMS and have a checkout page where info is inserted into the db using $wpdb->insert. I have 2 questions:
Is 'sql injection' already a part of that function or do I need to ...
2
votes
3answers
301 views
wordpress widget textbox in the sidebar
I have a normal textbox widget that I am using in certain sidebars. The text widget generates a div within a ul. Is there anyway to make the widget generate another ul li instead?
...
2
votes
2answers
761 views
Correct Approach for Validating Custom Field Input
I have a custom post type with several custom fields. I am looking to do some validation on these fields because they will be used downstream by other services. So, it is important that it can't be ...
2
votes
1answer
558 views
How can I make post fields required in Wordpress?
I am setting up a Wordpress site as a CMS and trying to figure out a way to make certain post fields "required" before an author can publish a post.
In particular, I want authors to be required to ...
2
votes
1answer
658 views
Server side validation for Contact Form 7
I'm trying to use contact form 7 on my site.
The only server side validation that it seems to do is check if required fields have been entered.
Isn't there a danger if someone sends several MB of ...
2
votes
3answers
365 views
validate a metabox based on the category that is selected
Ok Let's say I have 2 Categories. If a user select category A, they have to fill in metabox A and similarly for category B, it's metabox B. So my question is, I want to do a validate check, whereby if ...
1
vote
5answers
719 views
WordPress & W3C CSS Validation
I've played around with WordPress here and there for a few years and am wondering about problems with CSS validation with WordPress themes. This may seems like a stupid question, but:
Is there a ...
1
vote
2answers
3k views
wordpress site validation errors
when I made my wordpress site validate I got some strange errors like
Error Line 6, Column 52: Bad value profile for attribute rel on element link: Keyword profile is not registered.
Error Line 12, ...
1
vote
1answer
520 views
Duplicate attribute class causing site validation error
The following bit of code results in a duplicate attribute site validation error.
This template script:
<div class="clearfix" <?php post_class() ?>>
produces this source output:
...
1
vote
3answers
484 views
stray <p> elements
I coded a wordpress shortcode for columns that basically inserts html via a shortcode. Problem is that wpautop adds stray p elements that renders the code invalid.
To test put this into your ...
1
vote
1answer
324 views
Remove 'rel' attributes from the_category() output
I am trying to get the categories associated with a post in it's meta section by using the following code:
<div>FILED AS: <span class="gf-post-meta-result"><?php the_category(' ...
1
vote
2answers
218 views
Prevent empty Post Title on form submit via front end post (wp_insert_post_)
I am creating a post from the front end using (shortened for brevity);
if (empty($_POST['my_title'])){
echo 'error: please insert a title';
} else {
$title = $_POST['my_title'];
}
...
1
vote
3answers
654 views
Require a Custom Taxonomy to be checked
I have a custom taxonomy, "position", with multiple terms for a custom post type, "employee" in the admin. I want to validate the form to require a position to be selected when you save/update a post.
...
1
vote
2answers
629 views
<?php echo $title ?> vs <?php echo esc_html( $title ); ?> Wordpress Security
Reading this great article Data Validation and Sanitization in Wordpress I've noticed that in my blog, in header.php, I used <?php echo $title ?> in a pair of codes.
According to the above ...
1
vote
2answers
353 views
Validate an option array
We use the default WordPress register_setting() function to validate theme options. This call, for example:
register_setting( 'options-group', 'option1', 'intval' );
Will validate whether or not ...
1
vote
1answer
254 views
How do i validate data entered in a meta box so that only floats can be entered in a field?
We have a custom post type in our plugin and now i must provide the user a meta box where he enters latitude and longitude. I want them to be floats, i have no problems in doing the validation client ...
1
vote
1answer
113 views
Data validation
I find Data Validation page on Codex a bit confusing. It highlights what all functions do but not how one differs from another and which one should be the right choice in a particular use case.
Like ...
1
vote
1answer
424 views
Creating custom AJAX requests
My question pertains to where I should create an ajax function that I'd like to call from my page view.
I am using a jQuery validator on a custom form that should check the inputted zipcode against ...
1
vote
2answers
52 views
w3c validation problem - Twitter share button pulling content
I have this twitter share button that pulls 100 characters from the content of the post and its URL for the twitter share.
<a class="popup"
href="http://twitter.com/share?url=<?php
...
1
vote
2answers
532 views
Check if username exist with AJAX
I've created a custom registration form for a WordPress MultiSite installation. It allows registrations of new blogs and users. I want to check with ajax if a given username is available. This is what ...
1
vote
3answers
372 views
How to properly validate data from $_GET or $_REQUEST using WordPress functions?
I am working on a plugin that requires on-the-fly manipulation of content output. This is solely dependent on the current $_GET variable or $_REQUEST variable.
Depending on what the variable is set ...
1
vote
1answer
89 views
Persist fields with Setting API
In my admin panel, if I use a sanitizing callback register_setting() and the field does not pass through my custom validation, I've been preventing the database from updating by using return FALSE; ...
1
vote
2answers
194 views
Validate data on attachment_fields_to_save
I'm very glad that there is such a dedicated website for WP.
My problem is data validation upon saving attachment fields. I have added many custom fields to attachment/media library dialog, most of ...
1
vote
1answer
431 views
Data sanitization for user registration and user login
What kinds of data sanitization I have to do if I make a front end login and registration system for wordpress users?
For login function wp_signon() should I escape the data for
possible sql ...
1
vote
1answer
155 views
New custom theme option (text input) giving index error
I am using the theme-options.php file from ThemeShaper:
http://themeshaper.com/2010/06/03/sample-theme-options/
I can succesfully add new dropdown options, however when I add a new text input I ...
1
vote
1answer
377 views
How can i add validation to this login form with out it redirecting to the wp-login.php page
Im using the code as posted on the website below, to create a hard coded login form.
http://www.wprecipes.com/add-a-login-form-on-your-wordpress-theme
What would be the best way of incorperating some ...
1
vote
1answer
59 views
How to validate register settings array
I would like to know how to perform a proper validation with the register_setting() callback function.
Here is a sample part of my code I want to work with:
register_setting( 'wpPart_options', ...
1
vote
0answers
41 views
Only allow site url in text field using wp_kses/wp_filter_nohtml_kses?
I'm working on validation for a theme options page.
Is there a built in way to add an argument to wp_kses/wp_filter_nohtml_kses that will allow a specific link to be entered(wrapped in a tags) but ...
1
vote
0answers
133 views
Validating a cloned/repeatable input (jQuery)
I'm trying to create a repeatable field an upload image input with image preview for my Theme Options page and I have the following:
function theme_options_validate( $_POST ){
if ...
1
vote
1answer
70 views
Inconsistent server code response using HTTP API
I'm using Wordpress http api to get a server response code from youtube api so I check the validity of a video. I do this in a function from my functions.php which processes my post form where I ...
1
vote
0answers
33 views
Showing errors from processing function on form
I use a function from my functions.php to process a front end post form. I store the errors in the variable $output but need a way to show it on the post form after submit. How can I do that?
1
vote
0answers
160 views
Validating buddypress custom profile fields
I'm using buddypress and I offer users the chance to add links to their social networks (facebook/twitter) by entering the url's into custom profile fields. My issue is that people can;t follow ...
1
vote
1answer
28 views
correct tags for validating input types
I have following types of theme options inputs, which I need to validate.
$numbers = "#1234";
$email = "abc@example.com";
$simeple_text = "How's going?";
$code = "<script ...
1
vote
1answer
79 views
protect user submitted posts
I have a website that I am working on. I created an html form and put in some code that will take the form data and create a new wordpress post. It will post the information to a specific category. ...
1
vote
2answers
557 views
Get the user type of an author
I'm working on a site and I need to get the type of user the author is so I can mark it.
The idea is that if an Admin level user post something it has a [ADMIN] tag or something next to their name. I ...
1
vote
1answer
589 views
Multiple options pages validation for a plugin
I am writing a plugin and I decided to have multiple pages for different options of the plugin (for clarity's sake). Doing a single option was a piece of cake, but I'm encountering difficulties when ...
1
vote
2answers
2k views
Frontend Post Form Validation
OK, there have been several posts on here about frontend posting forms. I've read them all, which got me to where I am. Now every form I come across has some form of validation which seems to check ...
0
votes
1answer
143 views
Settings API - getting hidden input / submit button's name
I'm generating this form using Settings API:
<form action="options.php" method="post">
<?php settings_fields('XX_theme_settings'); do_settings_sections('my_settings'); ?>
...
0
votes
3answers
61 views
Validating widget's configuration data on Admin page
I have a simple widget that needs its width and height set by the user, so that it is displayed properly on the blog.
The thing is: on the Administrator/Appearance/Widgets page, if the admin user ...
0
votes
3answers
621 views
Can a shortcode included in post content add styles to the <head>?
I have a shortcode that iterates through a list of custom post types and, as part of displaying them, creates a block.
In HTML5, it is illegal to have a style block outside the header (maybe in other ...
0
votes
1answer
431 views
Remember form field values with page navigation
I have a form on a page template that controls which posts show up on the page and how those posts are ordered. You can see what I mean here: http://www.theseattlevine.com/the-vine
The questions I ...
0
votes
3answers
297 views
Alternative to esc_textarea
I need an alternative function to use with textareas in meta boxes instead of esc_textarea.
The problem is that when I use this function with textarea's it removes line breaks and paragraphs. Is ...
