[ad_1]
Thread Starter
Leo.Lin
(@bi1012037)
I added the following code to prevent non-logged-in users from frequently making GET requests:
add_action('wp', function() {
// Check if the user is not logged in and is using the add_to_wishlist parameter.
if (!is_user_logged_in() && isset($_GET['add_to_wishlist'])) {
//Stop execution and display "403 Forbidden
wp_die('You must log in to add items to your wishlist.', '403 Forbidden', array('response' => 403));
}
});