Created
April 17, 2020 08:05
-
-
Save platoosom/2d5c4f1d7aedf5f08ab05c1a70f84a41 to your computer and use it in GitHub Desktop.
Wordpress สร้างฐานข้อมูลขึ้นมาใหม่ถ้าหากมันไม่มี
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create custom table to keep import article url | |
*/ | |
add_action('init', 'topgear_create_import_exists_table'); | |
function topgear_create_import_exists_table() | |
{ | |
global $wpdb; | |
$charset_collate = $wpdb->get_charset_collate(); | |
$sql = "CREATE TABLE IF NOT EXISTS `{$wpdb->base_prefix}imported_articles` ( | |
ID bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, | |
slug varchar(255) NOT NULL, | |
PRIMARY KEY (ID) | |
) $charset_collate;"; | |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); | |
dbDelta($sql); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment