Bird
Raised Fist0
Wordpressframework~20 mins

Plugin installation and activation in Wordpress - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Plugin Pro
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
2:00remaining
What happens after activating a WordPress plugin?

After you activate a plugin in WordPress, what is the immediate effect on the website?

AThe website automatically updates to the latest WordPress version.
BThe plugin files are deleted from the server to save space.
CThe WordPress core files are replaced with the plugin's files.
DThe plugin's code starts running and can add features or change site behavior immediately.
Attempts:
2 left
💡 Hint

Think about what activating a plugin means for the website's functionality.

📝 Syntax
intermediate
2:00remaining
Which code snippet correctly activates a plugin programmatically?

In WordPress, which PHP code correctly activates a plugin named 'my-plugin/my-plugin.php'?

Awp_activate_plugin('my-plugin/my-plugin.php');
Bactivate('my-plugin/my-plugin.php');
Cactivate_plugin('my-plugin/my-plugin.php');
Dplugin_activate('my-plugin/my-plugin.php');
Attempts:
2 left
💡 Hint

Look for the official WordPress function to activate plugins.

🔧 Debug
advanced
2:00remaining
Why does this plugin activation fail with a fatal error?

Given this plugin main file code, why does activating it cause a fatal error?

<?php
function my_plugin_init() {
  echo $undefined_variable;
}
add_action('init', 'my_plugin_init');
ABecause $undefined_variable is not defined, causing a PHP notice but not a fatal error.
BBecause echo cannot be used inside functions hooked to 'init'.
CBecause using an undefined variable in echo causes a fatal error during activation.
DBecause add_action is called before WordPress is fully loaded.
Attempts:
2 left
💡 Hint

Think about what happens when PHP tries to echo a variable that does not exist.

state_output
advanced
2:00remaining
What is the value of 'active_plugins' option after activating two plugins?

Assuming the 'active_plugins' option initially is an empty array, what will it contain after activating these two plugins?

activate_plugin('plugin-one/plugin-one.php');
activate_plugin('plugin-two/plugin-two.php');
$active = get_option('active_plugins');
A['plugin-two/plugin-two.php']
B['plugin-one/plugin-one.php', 'plugin-two/plugin-two.php']
C[]
D['plugin-one/plugin-one.php']
Attempts:
2 left
💡 Hint

Activating plugins adds them to the active plugins list.

🧠 Conceptual
expert
2:00remaining
Which hook runs only once immediately after plugin activation?

Which WordPress hook is designed to run only once right after a plugin is activated?

Aregister_activation_hook
Bwp_loaded
Cplugins_loaded
Dinit
Attempts:
2 left
💡 Hint

Think about the special hook used to run setup code when a plugin is activated.

Practice

(1/5)
1. What is the first step to add new features to a WordPress site using plugins?
easy
A. Install the plugin from the WordPress dashboard
B. Activate the plugin before installation
C. Delete the plugin files manually
D. Edit the WordPress core files

Solution

  1. Step 1: Understand plugin addition process

    Plugins add features but must be installed first before use.
  2. Step 2: Identify correct first action

    Installing from the dashboard is the proper first step before activation.
  3. Final Answer:

    Install the plugin from the WordPress dashboard -> Option A
  4. Quick Check:

    Install before activate = A [OK]
Hint: Always install plugins before activating them [OK]
Common Mistakes:
  • Trying to activate before installing
  • Editing core files instead of using plugins
  • Deleting plugin files manually without uninstalling
2. Which of the following is the correct way to upload a plugin ZIP file in WordPress?
easy
A. Go to Plugins > Add New > Upload Plugin, then choose the ZIP file
B. Go to Appearance > Themes > Upload Plugin, then choose the ZIP file
C. Go to Settings > General > Upload Plugin, then choose the ZIP file
D. Go to Tools > Import > Upload Plugin, then choose the ZIP file

Solution

  1. Step 1: Locate the plugin upload option

    Plugins are managed under Plugins menu, not Themes or Settings.
  2. Step 2: Confirm correct menu path

    Plugins > Add New > Upload Plugin is the correct path to upload ZIP files.
  3. Final Answer:

    Go to Plugins > Add New > Upload Plugin, then choose the ZIP file -> Option A
  4. Quick Check:

    Upload plugin via Plugins menu = C [OK]
Hint: Upload plugins only under Plugins > Add New > Upload Plugin [OK]
Common Mistakes:
  • Trying to upload plugins under Themes or Settings
  • Uploading ZIP files in wrong menu
  • Not using the Upload Plugin button
3. After installing a plugin, what will happen if you do NOT activate it?
medium
A. The plugin will automatically activate after installation
B. The plugin will delete itself after 24 hours
C. The plugin features will not be available on the site
D. The plugin will slow down the site but still work

Solution

  1. Step 1: Understand plugin activation role

    Activation enables the plugin features to work on the site.
  2. Step 2: Identify effect of no activation

    Without activation, the plugin is installed but inactive, so features are unavailable.
  3. Final Answer:

    The plugin features will not be available on the site -> Option C
  4. Quick Check:

    Install without activate = no features [OK]
Hint: Install alone doesn't enable features; activate is needed [OK]
Common Mistakes:
  • Assuming plugins auto-activate after install
  • Thinking plugins delete themselves if inactive
  • Believing inactive plugins slow down site
4. You uploaded a plugin ZIP file but the plugin does not appear in the Plugins list. What is the most likely issue?
medium
A. The plugin is already active and hidden
B. The ZIP file is corrupted or not a valid plugin
C. You installed the plugin but did not refresh the page
D. You forgot to activate the plugin

Solution

  1. Step 1: Check plugin upload success

    If plugin does not appear, upload likely failed due to invalid ZIP or corruption.
  2. Step 2: Rule out other causes

    Activation or refresh does not affect visibility of newly uploaded plugin in list.
  3. Final Answer:

    The ZIP file is corrupted or not a valid plugin -> Option B
  4. Quick Check:

    Invalid ZIP means no plugin shown [OK]
Hint: Verify ZIP file validity if plugin missing after upload [OK]
Common Mistakes:
  • Assuming activation hides plugins
  • Not checking if ZIP file is valid
  • Thinking page refresh shows missing plugins
5. You want to install and activate a plugin that is not in the WordPress repository. What is the correct process?
hard
A. Install the plugin from Plugins > Installed Plugins without uploading
B. Copy plugin files to the theme folder and activate from Appearance > Themes
C. Edit the wp-config.php file to add the plugin path, then refresh the site
D. Download the plugin ZIP from the developer, upload it via Plugins > Add New > Upload Plugin, then activate it

Solution

  1. Step 1: Identify plugin source and upload method

    Plugins not in repository must be uploaded manually as ZIP files.
  2. Step 2: Follow correct upload and activation steps

    Upload via Plugins > Add New > Upload Plugin, then activate to enable features.
  3. Final Answer:

    Download the plugin ZIP from the developer, upload it via Plugins > Add New > Upload Plugin, then activate it -> Option D
  4. Quick Check:

    Manual upload and activate = A [OK]
Hint: Upload ZIP from developer, then activate plugin [OK]
Common Mistakes:
  • Placing plugin files in theme folder
  • Editing wp-config.php for plugins
  • Trying to install without uploading ZIP