The tag has no wiki summary.

learn more… | top users | synonyms

14
votes
2answers
556 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 ...
7
votes
3answers
5k 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 ...
6
votes
3answers
2k 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 ...
6
votes
2answers
116 views

Server side validation

I'm trying to do some server side validation of post fields (custom and/or non-custom fields). Validation works just fine, but I can't seem to stop the post from saving if validation fails. I tried ...
5
votes
3answers
5k 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 ...
5
votes
2answers
604 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
1k 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
2answers
4k 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 ...
4
votes
1answer
1k 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
3answers
847 views

How to Debug the 'save_post' Action?

Is it possible to validate PHP code? I have a Custom Post Type (Film) with Custom Meta Boxes. Everything is working fine, I can add new Films and details to the Custom Meta Boxes. My problem is ...
2
votes
5answers
1k 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 ...
2
votes
2answers
467 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']; } ...
2
votes
2answers
361 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
1k 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 ...
2
votes
2answers
2k 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
3answers
433 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
1k 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
111 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; ...
2
votes
1answer
181 views

How to load some jquery code to make validation in the theme customizer?

i am tring to load some jquery code to make validation in the theme customizer. i have created 10 checkboxes to show some info. but i want to limited the user to choose only 5 checkboxes. so i have ...
2
votes
1answer
1k views

Server side validation for Contact Form 7 [closed]

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
438 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 ...
2
votes
0answers
67 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
115 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 ...
2
votes
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 ...
1
vote
3answers
665 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
2answers
1k 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
2answers
4k 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
1k 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
1answer
738 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
3answers
2k 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
3answers
487 views

How do I sanitize a javascript text?

I have a textarea that will receive a js snippet(Google Analytics). Is there a way to sanitize that? Since I cannot use functions like wp_filter_nohtml_kse(), what should I use?
1
vote
2answers
5k views

How do I edit wp_head and/or functions.php to remove rss-feed which isnt used and dont validate?

When using w3.org's validation tool Unicorn I get the following error/warning: URI: http://energyshop.se/hem/feed/ This feed does not validate. After looking into my source its there crystal clear ...
1
vote
2answers
2k 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
1answer
388 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
3answers
943 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 ...
1
vote
1answer
122 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
1k 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
1answer
183 views

Add Div to Comment Form

I have some code that displays my comment form and my custom validation, what I'd like to do is add a div right underneath the title, but I'm not sure how to do that because that code is generated... ...
1
vote
1answer
502 views

jQuery Validate wp_editor

I have a form, and in the form, I use <?php wp_editor('', 'user_submitted_progress', $settings = array('textarea_name' => 'user_submitted_progress')); ?> to generate a TinyMCE, rather than ...
1
vote
2answers
248 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
1answer
299 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
2answers
1k 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
2answers
370 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
853 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
1answer
690 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
186 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
623 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
0answers
12 views

Multiple register settings, with same option name - issue

I already posted this question in wordpress support forums here but I didn't get any help and nor could I find a solution yet. As the title says, I am calling register_settings functions multiple ...
1
vote
0answers
55 views

Resetting admin post form on JS validation fail

I've got a custom plugin with a metabox and dynamic form (the user can ask for more elements of the form), with jQuery Validation plugin working great. The problem is when the validation comes back ...
1
vote
1answer
469 views

WooCommerce Custom Product Validation [closed]

I'm attempting to build a membership system in WordPress that utilizes WooCommerce with Gravity Forms and integrates with SalesForce. Can somebody give me some direction on how to properly utilize ...