How to add onclick to a link in WordPress

If we want to add the "onclick" attribute to the link, then WordPress will remove it when saving the post.

To prevent this from happening, allow the use of this attribute:


global $allowedposttags;
$allowedposttags['a']['onclick'] = 1;

Updated: 08.02.2019

Did this article help you? Rate it!
(No Ratings Yet)

Leave a Reply

Your email address will not be published. Required fields are marked *


Send message