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!