Abnormal “Add to Wishlist” requests caused the website to malfunction.

[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));
}
});

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer