Security plugins in WordPress work by first being installed and activated. Once active, they monitor the website for suspicious activity like hacking attempts or malware. When a threat is detected, the plugin can block the attack and notify the site administrator. The admin can then review alerts and adjust settings if needed. This process repeats continuously to keep the site secure. The example code activates the Wordfence plugin if it is not already active. The execution table shows each step from checking activation, activating, monitoring, detecting threats, alerting, and ongoing protection. Variables track the plugin's active state, detection of threats, and admin alerts. Key moments clarify why activation is necessary, what happens on threat detection, and that monitoring never stops. The quiz tests understanding of plugin state and behavior during execution. This visual trace helps beginners see how security plugins protect WordPress sites step-by-step.