Encoding Contact Data with a Shortcode and Hook for Third-Party Plugins
This article explains how to use the CleanTalk shortcode and hook features to encode and protect contact data. This is especially useful for web developers and site owners who want to hide sensitive information (such as emails or other contact details) from bots while allowing legitimate users to access the information when needed.
Even if the main encoding option is turned off, CleanTalk offers alternative encoding methods via shortcodes and hooks:
1. Using the Shortcode
Add the following code directly into your content using the visual editor:
[apbct_encode_data]any text to encode[/apbct_encode_data]
This will encode the specified text so it appears hidden to bots on the public site. Legitimate users can decode the information by clicking on it, similar to encoded email links.
2. Using the Hook
For developers, the hook apbct_encode_data provides a flexible way to encode any data from source code. Wrap any text you want to encode with this hook, like so:
function encode_contact_data_example () {
$encoded_text = apply_filters('apbct_encode_data', 'any text to encode');echo $encoded_text;
}
add_action( 'wp_footer', 'encode_contact_data_example');
The $encoded_text variable will contain the encoded version of "any text to encode". Display this variable on the page, and it will be accessible to users by click, while remaining hidden from bots.
You can see the result here:
By using these methods, you can control which information is visible to bots and ensure legitimate users can access encoded contact data safely.
It would also be interesting
- How to protect a form with honeypot fieldHoneypot field option for WordPress We've added an additional feature if you want to improve your...
- Encode contact data WordPress optionHow to hide (encode) email addresses on your WordPress website from crawlers and bots Since the...
- Bulk Check of IPs and EmailsHow to Check IPs and Emails in Bulk We offer a public interface to check any list of IPs...