The activation process of a plugin is handled by the built-in register_activation_hook function. In this scenario, we are developing a simple plugin to illustrate the importance of concepts in plugin development. Here, we will be using the built-in activation event to initialize the settings and data for this plugin, instead of creating separate installation process. Add the following code to the wpquick-post-attachments.php file, after the header comments section:
register_activation_hook( __FILE__, 'wpqpa_activate' );function wpqpa_activate(){ global $wpdb; $table_attachments = $wpdb->prefix . 'wpqpa_post_attachments'; $sql_attachments = "CREATE TABLE IF NOT EXISTS $table_attachments ( id int(11) ...