function preprocess_mycomment($commentdata) {
$existing_comments = get_comments( array('post_id' => 31691) ); // I run the code for one specific page only
foreach ($existing_comments as $comment) {
$previous_comments = $comment->comment_author_email; // email address send by the current poster
if ( $previous_comments == $commentdata['comment_author_email'] ) { // comparing the current email address with the previous ones in database.
wp_die('The email ' . $previous_comments . ' has already been used.');
}
}
return $commentdata;
}
add_filter('preprocess_comment', 'preprocess_mycomment');
Related Posts:
- Sending data from custom inputs in WordPress comment form in the admin notification email
- edit_comment_link is not showing for comment author
- Add custom field on admin dashboard comments / reviews
- what is correct way to hook when update post
- Using register_activation_hook in classes
- WordPress and event-driven programming – what is it about?
- Custom plugin: Trying to show saved data on frontend
- Receiving Stripe Webhooks on a wordpress website
- Remove Woocommerce product link
- Check php version before theme activation
- Display user’s total comment count outside The Loop
- Facebook Comment Count
- Change the footer text on the login page
- How can I remove “Proudly powered by WordPress” from twentyeleven without modifying footer.php?
- How can I hook into and edit the text of a wp_nav_menu tag?
- How to remove a metabox from menu editor page?
- Getting the comment number relative to all the post’s comments
- How to output a permanently delete comment link?
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- Check if page parent has certain template
- Multiple wp_schedule_event cron jobs in plugin cause multi-execution
- How to remove “out of stock” variation options from size dropdown in woocommerce?
- count number of user comments with a specific comment meta value
- Change comments form title on a page by page basis
- Prevent publish status/date saved on transition_post_status hook
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- How to Remove a Filter from the Admin List Table?
- How do I make wordpress comment fields required?
- How do I create comment-reply-button using element not
- Hooking new functions to actions + passing parameters
- Woocommerce, recognize the loop of related products
- Find variables available at a given hook
- Passing data between two hooks in separate HTML requests
- How to check if comments are paginated?
- Is $hook a global variable in WordPress
- Replace existing content from specific WooCommerce admin orders list column
- Executing `createimagefrompng()` from save_post hook (or equivalent hook)
- Notify WordPress Site I Have Linked To Them
- Getting my head round WordPress filter
- Delete option value from array using update_option()
- Add “last” and “first” to WordPress Comment Pagination Links
- enqueue hover function
- Uncaught TypeError: Cannot read property ‘firstChild’ of null after upgrading to WordPress 5.5
- How To Change The Html of Products filtration sidebar in Woocommerce?
- Replace comment avatars and links at the same time
- Automatically generate Post/Page from searched Database item?
- How to set a custom path, for ajax image upload folder in admin?
- Insert all post IDs in new database table
- Adding ads code between comments
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- action hook wp_head higher priority as all other plugins/hooks
- using add_action for a header hook that has an additional parameter
- How do I fetch all comments per post via WP REST API?
- When using the_author hook, how can I determine the PHP file that generates each call to `the_author()`?
- How to call function at the bottom of post using plugin?
- How to add a second ‘place order’ button in WooCommerce [closed]
- comments_number display outside specified span
- Trying to implement Ajax comments in WordPress, getting WP error
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How does this WordPress Plugin (Thrive Comments) apply their custom comment sort? [closed]
- Setting up 2 SMTP accounts: 1 for wordpress and 1 for woocommerce
- wp_loaded hook block script enquequing
- Show comments menu in dashboard only if the site has comment
- Handling Body class based on Template
- How to load a template-part based on a url wildcard?
- Remove an action hook within a Class
- How to pass arguments to add_action() or retrieve return value of called function?
- hook that when page is starting to load
- “comments.php” not available after edit in WP administration
- How to change home or site url using action hooks or filter?
- ajax, right way to do it and make it works?
- User’s total comment count excluding comments on their own posts
- Edit incorrect password message WordPress
- Show wp_die if url form comment not emply
- Why does my callback function not work with this custom filter hook?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- Reload part of checkout on changed shipping method
- Trying to build simple deposit code that hooks into woocommerce
- Contact Fom 7 – how to add custom HTML inside span.wpcf7-form-control-wrap AND IMMEDIATELY AFTER input.wpcf7-form-control?
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Remove metabox from WordPress menu editor page?
- Add a product to checkout via form
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Why ajax doesn’t work on certain wordpress hooks?
- Remove a div from RSS feed
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- user_profile_update_errors hook not executing
- Set meta field to publish date + 2 weeks
- How to add an arrow to menu items has submenus
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- How to implement a rating and review system for WordPress custom posts?
- Don’t insert if permalink is the same?
- Return a numerical function value in Customizer controls
- Adding widgets to my plugin page instead of WordPress dashboard
- Ajax load more button for comments wordpress
- Limit 1 global comment per minute
- Adding function to Genesis genesis_header [closed]