Questions tagged [wp-kses]

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

9 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
207 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
28 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
0answers
16 views

Accepting certain HTML tags in WP List Table column data

In my custom post type, 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 WP ...
1
vote
1answer
39 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 be ...
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
311 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
174 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
44 views

Remove all <span> elements and style attributes from HTML

I'm retrieving some HTML (regulatory press releases) from an external source via an API. This HTML will be inserted as custom posts into the WordPress database. Naturally, I want to sanitize the ...
0
votes
1answer
324 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 ...