0
0
Wordpressframework~10 mins

Plugin installation and activation in Wordpress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to activate a plugin in WordPress.

Wordpress
activate_plugin('[1]');
Drag options to blanks, or click blank then click option'
Amy-plugin/my-plugin.php
Bthemes/my-theme
Cindex.php
Dwp-content/plugins
Attempts:
3 left
💡 Hint
Common Mistakes
Using the full server path instead of relative plugin path.
Using theme folder path instead of plugin path.
2fill in blank
medium

Complete the code to check if a plugin is active.

Wordpress
if (is_plugin_active('[1]')) {
    // Plugin is active
}
Drag options to blanks, or click blank then click option'
Amy-plugin/my-plugin.php
Bthemes/my-plugin.php
Cplugins/my-plugin.php
Dwp-content/plugins/my-plugin.php
Attempts:
3 left
💡 Hint
Common Mistakes
Including full path starting with 'wp-content/plugins'.
Using theme folder path.
3fill in blank
hard

Fix the error in the code to properly install a plugin from a ZIP file.

Wordpress
$result = install_plugin('[1]');
Drag options to blanks, or click blank then click option'
Amy-plugin.zip
Bhttp://example.com/my-plugin.zip
C/var/www/html/wp-content/plugins/my-plugin.zip
Dplugins/my-plugin.zip
Attempts:
3 left
💡 Hint
Common Mistakes
Using local file system paths instead of URLs.
Using relative paths without URL.
4fill in blank
hard

Fill both blanks to activate a plugin only if it is not already active.

Wordpress
if (![1]('[2]')) {
    activate_plugin('[2]');
}
Drag options to blanks, or click blank then click option'
Ais_plugin_active
Bmy-plugin/my-plugin.php
Cactivate_plugin
Dplugin_dir_path
Attempts:
3 left
💡 Hint
Common Mistakes
Using the activation function in the condition instead of the check function.
Using incorrect plugin path format.
5fill in blank
hard

Fill all three blanks to safely deactivate a plugin.

Wordpress
if ([1]('[2]')) {
    [3]('[2]');
}
Drag options to blanks, or click blank then click option'
Ais_plugin_active
Bmy-plugin/my-plugin.php
Cdeactivate_plugins
Dactivate_plugin
Attempts:
3 left
💡 Hint
Common Mistakes
Using activation function instead of deactivation.
Not checking if plugin is active before deactivating.