سلام و عرض ادب این کدها رو به این شکل زدم اما بعد از غیر فعال کردن پلاگین جدول و کانفیگها در دیتابیس پاک نمیشن ممنون میشم بفرمایید مشکل کجاست؟
<?php
/*
Plugin Name: wordpress config table
Plugin URI: https://narmafzar5.com/
Description: wordpress plugin to manage config and table
Version: 1.0.0
Author: erfan
Author URI: https://erfantayebi.ir
License: GPLv2 or later
Text Domain: wordpress-config-table
Domain Path: /languages/
*/
function pi_install_defult_configs()
{
$current_configs = get_option('pi_configs');
if (!$current_configs){
$defult_configs = [
'amount' => 500000,
'role' => 'administrator'
];
update_option('pi_configs' , $defult_configs);
}
}
function pi_install_db()
{
global $wpdb ;
$customer_table_name = $wpdb -> prefix . 'customers' ;
$collate = $wpdb -> get_charset_collate();
$customer_table_sql = "
CREATE TABLE IF NOT EXISTS `{$customer_table_name}` (
`ID` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`wallet` int(11) NOT NULL,
`total_orders` int(11) NOT NULL
) {$collate};
";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($customer_table_sql);
}
function pi_uninstall()
{
global $wpdb ;
$customer_table_name = $wpdb -> prefix . 'customers' ;
$wpdb->query("DROP TABLE IF EXISTS {$customer_table_name}");
delete_option('pi_configs');
}
function pi_activate()
{
pi_install_defult_configs();
pi_install_db();
register_uninstall_hook(__FILE__ , 'pi_uninstall');
}
register_activation_hook(__FILE__ , 'pi_activate');