August 2017
Beginner
412 pages
10h 30m
English
The first part of this plugin has to be run only when the plugin is activated. This will be the initialization function. One of its tasks is to create or update the database table (the table will be created only if it hasn't been created before):
function searchedwords_init($content) { global $wpdb; $sw_table_name = $wpdb->prefix.'searchedwords'; //creating the table (if it doesn't exist) or updating it if // necessary if(isset($_GET['activate']) && 'true' == $_GET['activate']) { $sql = 'CREATE TABLE `'.$sw_table_name.'` ( id INT NOT NULL AUTO_INCREMENT, word VARCHAR(255), created DATETIME NOT NULL DEFAULT \''.date('Y-m-d').' 00:00:01\', PRIMARY KEY (id) )'; require_once(ABSPATH.'wp-admin/includes/upgrade.php'); ...Read now
Unlock full access