Thread Starter
5lions
(@5lions)
I tried several of the email obfuscating plugins, but most fail because their require a short code, which is flagged as invalid in the email address field when trying to submit and new AD.
Then I found this plugin, which does not require short codes at all:
https://wordpress.org/plugins/email-address-encoder/
However, it doesnt work with WPAdverts.
Does WPAdverts work with any email obfuscating plugins? My users are unhappy about all the spam.
I am guessing obfuscating plugins will not work with WPAdverts as they only scan page content to replace email address not the AJAX requests.
You can use a code like the one below to make the email addresses harder to read
add_action("init", "obfuscate_contact_email_init", 20);
function obfuscate_contact_email_init() {
remove_action('wp_ajax_adverts_show_contact', 'adverts_show_contact');
add_action('wp_ajax_adverts_show_contact', 'obfuscate_contact_email_ajax');
}
function obfuscate_contact_email_ajax() {
$id = adverts_request("id");
$post = get_post($id);
if( $post === null || $post->post_type != 'advert') {
echo json_encode( array(
'result' => 0,
'error' => __("Post with given ID does not exist.", "adverts")
));
exit;
} else {
echo json_encode( array(
'result' => 1,
'email' => str_replace("@", " [at] ", get_post_meta( $id, 'adverts_email', true ) ),
'phone' => get_post_meta( $id, 'adverts_phone', true )
));
}
exit;
}
Or you can use the code snippet posted here to replace contact information box with a contact form https://wordpress.org/support/topic/show-contact-information-1?replies=10