Questions tagged [wp-kses]

Function to filter (validate/sanitize) strings with a view to discharge all not allowed HTML elements.

10 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
36 views

Accepting certain HTML tags in WP List Table column data

In my Custom Post Type (CPT), I altered the display of the post title using the method mentioned here. But for my custom use case, I need to pass some HTML like <sup></sup>. But by default ...
2
votes
0answers
221 views

How to allow internal links using wp_kses filtration

I'm working on front end submission and of course I want to secure data by filtering before inserting to database. The form contains repeatable fields group data which I want filter by wp_kses ...
1
vote
0answers
83 views

Why wp_kses() not working for rel, target of link in Wordpress

I am using below code for wp_kses(). But it's ignoring rel & target in the result. I want to show rel="nofolow" target="_blank" in my result (link). $link = "Here is my link: <a href="my-link" ...
1
vote
1answer
41 views

Why is WordPress Breaking Custom Elements with Hyphens Into Element and Attribute?

Background I have a custom element in a page, which has a tagname of: column-set. On the front end, that gets written as <column -set="">. Question Why is this happening, and can it ...
1
vote
0answers
25 views

I want to allow the use of a data-flw attribute in links in comments

I have come up with two ways I thought this should work and I'm having no joy with either. First I tried hooking into the preprocess_comment filter. // Set allowed html in comments. add_filter( '...
1
vote
0answers
371 views

Add Attribute to p Tag of Post Content

I would like the default <p> elements that are added to the (TinyMCE) editor when users post content, to have a dir attribute as well. Reasoning: When the editor is displayed to users, it is ...
1
vote
0answers
183 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 ...
0
votes
0answers
30 views

Is it possible to run wp_kses on all posts?

For security purposes, we're mostly using the wordpress json api to display our posts/categories and we went to remove any malicious tags. I'm a bit unfamiliar with WP development... but what I'm ...
0
votes
0answers
32 views

Prevent attacks, $_POST data security, wp_strip_all_tags

When writing code that accepts input from users I always sanitize data one variable at a time. Example: $title = wp_strip_all_tags($_POST['title']); $content = wp_strip_all_tags($_POST['content']); ...
0
votes
1answer
331 views

Any ideas how to allow CSS input to perfectly work in the text area with wp_kses?

I'm having issues with wp_kses. I have a text area that allows CSS input (only) While the rest of the CSS gets through (don't have any issues ever since). Until one user , inputs a CSS Code like this ...