Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
David Ribatto

Custom Column – Data attribute not render

Hi,

I Would like to add data attribute in value render like this

return sprintf(
 '<label class="toggle-favorite">
<input type="checkbox" class="favorite-toggle" data-post-id="%d" %s />
    		        <span class="slider"></span>
    		    </label>',
    		    esc_attr($post_id), 
    		    esc_attr($checked) 
);

but the html render is without data-post-id and $checked value.

How can I render the input with data attribute ?

Thanks for your help

3 weeks, 1 day ago
David Ribatto

Ok. I found the solution.
The data attribute must be allowed by KSES filter.

3 weeks ago

You must be logged in to reply to this topic.