Complete the code to activate a plugin in WordPress.
activate_plugin('[1]');
To activate a plugin, you need to specify its main file path relative to the plugins folder.
Complete the code to add a plugin's functionality using a WordPress hook.
add_action('init', [1]);
The 'init' hook runs early, and you add your plugin's function name as a string to attach it.
Fix the error in the plugin activation code below by filling the blank.
if ( !function_exists( '[1]' ) ) { function my_plugin_function() { // plugin code } }
This checks if the function 'my_plugin_function' exists before defining it to avoid errors.
Fill both blanks to correctly register a shortcode in a plugin.
add_shortcode('[1]', [2]);
The first blank is the shortcode tag, and the second is the function that runs when the shortcode is used.
Fill all three blanks to create a plugin that adds a custom menu item in the admin dashboard.
add_action('[1]', '[2]'); function [3]() { add_menu_page('Custom Page', 'Custom Menu', 'manage_options', 'custom_slug', 'custom_page_callback'); }
The 'admin_menu' hook is used to add menu items. The function name must match in both places.