Choose the main purpose of installing a security plugin on a WordPress site.
Think about what security means for a website.
Security plugins help protect WordPress sites from hackers, malware, and unauthorized access.
After activating a security plugin that includes a firewall, what behavior should you expect?
Firewalls act like guards at the gate.
A firewall filters and blocks harmful traffic before it can harm your website.
Identify the correct PHP code to show an admin notice after activating a security plugin.
<?php
function show_activation_notice() {
echo '<div class="notice notice-success is-dismissible"><p>Security plugin activated!</p></div>';
}
add_action('admin_notices', 'show_activation_notice');
?>Check for correct syntax: semicolons, quotes, and function references.
Option B correctly uses quotes around the function name, includes semicolons, and closes all parentheses.
Review the code below and select the reason it causes a fatal error when activated.
<?php
function block_ip() {
$blocked_ips = ['192.168.1.1', '10.0.0.1'];
if (in_array($_SERVER['REMOTE_ADDR'], $blocked_ips)) {
wp_die('Access denied');
}
}
add_action('init', 'block_ip');
?>Check if all variables are always defined when the code runs.
Sometimes $_SERVER['REMOTE_ADDR'] is not set, causing an undefined index error. It should be checked before use.
Given the code below, what will a visitor from IP '192.168.1.1' see?
<?php
function block_ip() {
$blocked_ips = ['192.168.1.1', '10.0.0.1'];
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
if (in_array($ip, $blocked_ips)) {
wp_die('Access denied');
}
}
add_action('init', 'block_ip');
?>wp_die stops the page and shows a message.
wp_die displays the message and stops further script execution, showing a simple error page.