The tag has no wiki summary.

learn more… | top users | synonyms (1)

0
votes
0answers
11 views

Why are iframes from WordPress oEmbed stripped with wp_kses_post?

The docs for wp_kses_post() say "Sanitize content for allowed HTML tags for post content." iframe in general is an allowed tag, but more specifically I think it should allow tags created by WordPress ...
0
votes
0answers
23 views

sanitize_text_field and apostrophe problem

I've written a custom plugin to send data via a form to a personal database, different from the WP one. Everything is working fine except the fact that when you write a name, for example D'ALESSANDRO, ...
0
votes
0answers
31 views

Post meta sanitization and escaping

I'm writing a plugin that adds a text meta box where user enters (supposedly) media URL, which then is displayed in posts with $featured_media = get_post_meta( $post_id, '_meta_key', true ); echo ...
1
vote
0answers
14 views

Change wp_sanitize function?

I have a domain name like sép. wp_sanitize functions clears the écharacter. I would like to change it, but I cannot redeclare in functions.php. Is it possible to change, or WordPress cannot run ...
3
votes
1answer
110 views

Escaping WP_Query tax_query when term has special character(s)

Here's my issue. I have a custom post type that I'm attaching a custom taxonomy to. This taxonomy will allow the admin to provide search suggestions that will ensure the post is found when a user ...
0
votes
1answer
34 views

Sanitization html output itself

I've just started code according to VIP WordPress Coding Standards and I stuck with sanitization. I know that all outputs need sanitization without any exception. But how can I do sanitization of a ...
0
votes
1answer
21 views

Comparing pre-saved post_title to post-saved post_title

I'm implementing an inventory updater on a Wordpress product site that integrates with a 3rd-party website via their custom api. We're going to have a number of people updating the 3rd-party website, ...
0
votes
1answer
40 views

Can A Post Meta Field Store multiple values that are not in an array?

I have a post_meta field that seems to be displaying multiple values, yet they do not seem to be in an array. Using debug bar, this is what I see inside of the ...
0
votes
1answer
44 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 ...
0
votes
1answer
43 views

esc_attr on get_post_meta [closed]

Simple question, I see that some themes are using esc_attr or esc_html and url after they define varible with get_post_meta, while others are using it during variable definition. What would be best ...
0
votes
2answers
77 views

How to sanitize select box values in post meta?

I have added a select box in the Post meta. Here is the code, and it works fine. My question is, do I need to sanitize the values before updating the post meta? If yes, how it should be done? This is ...
0
votes
0answers
38 views

How to disable special character sanitizing for slugs

We are trying to track specific blog posts that are shared on social media sites and tech blogs. I selected Google Analytics for this and using Google UTM URL builder, I created a custom campaign ...
0
votes
1answer
29 views

Using esc_url_raw with protocols properly

I'm trying to build up my own function to sanitize a URL before saving it to my WP database. However I cannot get esc_url_raw to trigger against unwanted protocols. The function below is letting all ...
0
votes
1answer
20 views

Filter string like a slug

I have a WordPress site using pretty permalinks. I want to filter a string to that the it ends up with the exact same formatting as the url slug, does anyone know the filter or function to do so?
0
votes
1answer
67 views

Trouble creating custom sanitization function for user list dropdown

I'm trying to create a custom author info box on homepage which will automaically generate by getting the info from user profile when a user is selected from theme customizer. I followed the code ...
0
votes
1answer
109 views

WP_Editor - Saving Value into Plugin Option - Stripping HTML

I have a wp_editor(); on my plugin settings page. I also have enabled the "Font Size" drop down in TinyMCE. After highlighting text in the wp_editor(); and selecting a font size from the editor's ...
0
votes
0answers
48 views

Sanitize html, where to sanitize

I have a function that returns an style=".." html attribute. I am not sure how to sanitize. Here is the code: functions.php function zz_style($properties, $values) { $styles_array = array(); ...
10
votes
3answers
927 views

Should I sanitize an email address before passing it to the is_email() function?

I'm using is_email() to check if a user-provided email address is valid. For example: $email = $_POST['email']; if ( is_email( $email ) ) // Do something. To the best of my knowledge, nothing ...
1
vote
2answers
93 views

sanitizing integer input for update_post_meta

When updating a post meta where the input will be always an integer, should i use (int) or is there any WordPress function for that (eg. sanitize_text_field) For example ...
1
vote
0answers
31 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 ...
0
votes
1answer
64 views

How does Wordpress store data?

I have looked inside Wordpress database. Example: In wp_options table, option_name column, active_plugins row, its option_value is ...
4
votes
1answer
175 views

What is the difference between wp_strip_all_tags and wp_filter_nohtml_kses?

Taken from the articles referenced below: wp_strip_all_tags() "Properly strip all HTML tags including script and style." wp_filter_nohtml_kses() "Strips all of the HTML in the content." Ref: ...
0
votes
1answer
188 views

is_email() VS sanitize_email()

If I'm allowing a user to enter an email address to be saved into the database, should I use is_email() or sanitize_email()? Ex. update_user_meta( $user_id, $social_site, sanitize_email( ...
0
votes
1answer
33 views

Post text sanitization after publishing/editing - changes are not saved

I'm developing a simple plugin that does additional processing on post text when user saves/updates the post (i.e. clicks Publish post or Update post button). function ...
0
votes
1answer
364 views

Safely store code(html/js..) into database

So I'm working on a small plugin, and this plugin allows users to save data to my db. This data is mostly plain text but 3 fields are will have tags inside them. 1 field can be used to save all kind ...
0
votes
1answer
81 views

Save selectlist value (taxonomy) in wp:wp_set_object_terms

In my admin for part i have additional fields (like price or brand - which is taxonomy). When i edit or create new part, i set up additional data. and price saving is without any problem, but saving ...
1
vote
1answer
181 views

Do we have to santise html passing into Javascript ? How?

I am passing a <ul><li></li><ul> to jquery .html() method and it works. I am assigning the html to a varaible and passing to .html() method . As some security scans suggest ...
1
vote
0answers
132 views

How to escape custom css?

I'm creating a WordPress theme in which I've allowed users to add some custom css from the Theme Options. This css code then directly gets echoed out in the head section of the page, with the ...
0
votes
1answer
139 views

wp_kses ignore allowed and allow everything

Here is an example: $allowedPart = "<a href='http://alink.com'></a>"; $unsafePart = "<h1>A title</h1>"; $unsafePart .= "<script>alert('a ...
0
votes
0answers
98 views

Sanitize Term Custom Field - apostrophe problem

Alright guys, before posting I've searched the similar questions but I couldn't find the answer. Problem: I've added custom fields to a custom taxonomy, when I'm saving the options using ...
0
votes
1answer
99 views

Trouble creating custom sanitization function when uploading video files

I'm trying to create a Theme Customizer control in Wordpress that will allow the user to upload an MP4 and WEBM video, and in doing so I need to create a sanitization option to verify the file type. ...
3
votes
1answer
346 views

Make shortcode work with nested double quotes

I have following shortcode: function infobox_shortcode( $atts, $content = null ) { extract( shortcode_atts( array( 'src' => '', 'title' => '', 'text' => '', ), ...
2
votes
1answer
1k views

When to use esc_html and when to use sanitize_text_field?

It seems that they do almost same type of job. So... When should I use esc_html() instead of sanitize_text_field()?
1
vote
1answer
641 views

How to safely sanitize a textarea which takes full HTML input

I'm developing a plugin which enables the user to send HTML emails from within the WordPress admin. How should I sanitize the textarea input? It has to be able to contain the whole range of HTML tags ...
0
votes
4answers
96 views

Do we need to escape data that we receive from theme options?

I'm creating a Wordpress theme that I'm hoping to sell on Themeforest. Now I know much about escaping user inputted data using functions like esc_html, esc_url and so on and I use them in the comments ...
0
votes
2answers
389 views

Sanitaizing Select Optin For Custom Post Type Metabox in WP

Using WordPress 3.8.1, I have a Custom post Type called "Map" and it contains a Metadata which is a Select options element as: <label for="my_meta_box_select">Countries</label> <select ...
0
votes
1answer
67 views

Custom-Metaboxes-and-Fields text_url field prepending http://

I'm using the Custom Metaboxes and Fields code wich is pretty good. However I need sanitization on URL fields of course but the built in text_url field type is adding 'http://' to my entries. I know ...
0
votes
1answer
50 views

How to handle complex data with Settings API

I hope my question isn't out of the scope of this website and that someone can help me with it. I'm currently studying the WP Settings API and I'm wondering how to create a form management section ...
0
votes
1answer
152 views

I'm confused about url sanitization in meta boxes

I'm making meta box for a custom post. This meta box will contain a href value. I dont need any validation that is it valid href value but i would like to do this in a way that it is secure. I have ...
1
vote
1answer
32 views

Sanitize Disqus API results?

Can I trust the results from the Disqus API, not to include evil scripts? Can I find information somewhere. Would you sanitize the JSON data, that is returned? Official answers?
1
vote
1answer
214 views

Getting error to display radio button value in General Settings page

I'm constantly getting the errors bellow when printing the radio button values from General Settings screen: Illegal string offset 'service' in ...
1
vote
1answer
700 views

How to sanitize user input?

What is the correct way sanitizing form data before submitting to the database? I have the following text input: <form method="post" action="options.php"> <?php ...
0
votes
1answer
60 views

Toggle Shortcode Sanitize Title

Wondering if anyone can help me out... here is my custom theme shortcode: add_shortcode('toggle', 'shortcode_toggle'); function shortcode_toggle( $atts, $content = null ) { ...
0
votes
1answer
89 views

data-type=“” … needed post tags stripped of characters

So I am trying to generate a list of post tags on the data-type attribute but I need them to be sanitized so spaces are replaced with underscores and there are no special characters... really ...
3
votes
1answer
205 views

Do Cookies Need to be Sanatized Before Being Saved?

I recently wrote a plugin and now I'm backtracking a bit to sanitize any and all user input. I know that I should sanitize anything that comes from $_GET or $_POST as a user can insert malicious ...
1
vote
3answers
546 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?
0
votes
1answer
55 views

Settings api sanatize callback not being triggered

I'm creating a custom settings page for a custom theme however the callbacks for sanatizing the data in the fields are not being called (I put in xdebug breakpoints in them to check). /** ...
0
votes
1answer
219 views

Auto post with filling templates from external data and update periodical

Hi I want to achieve the following szenario and asking for advice to start off Szenario We have an external mysql-database filled with product informations. This database is delivering data for a ...
0
votes
1answer
59 views

Output Sanitation

I've read the WP codex and several tutorials about data validation and sanitation in WordPress. Now I've got this simple example code: $title = "<script>alert('Test')</script>"; echo ...
0
votes
0answers
22 views

What data sanitzation function should be used to store entire source code of webpage?

What is the best data santization function to use when the entire source code of a webpage (head, body elements, etc) are going to be stored in a post meta field? In other words, which function will ...