<?php
/*
Plugin Name: my mega plugin
Plugin URI: https://wwwww.ru
Description: API Кабинета
Version: 1.0
Author: Djo
Author URI: http://wwwww.ru
*/
if (!defined('ABSPATH')) {
exit;
}
add_action('plugins_loaded', 'my_init_mega_plugin_start');
function my_init_mega_plugin_start()
{
if( current_user_can('manage_options') ){
if (isset($_POST['name'])) {
global $wpdb;
$result = $wpdb->query('INSERT INTO `wp_buttons_menu`(`name`) VALUES (' . $_POST['name'] . ')');
if ($result) {
header('Location: /wp-admin/admin.php?page=menu_custom');
}
}
}
}
?>
<?php
define('SHORTINIT', true);
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
add_action('plugins_loaded', 'start');
function start()
{
if( current_user_can('manage_options') ){
if (isset($_POST['name'])) {
global $wpdb;
$result = $wpdb->query('INSERT INTO `wp_buttons_menu`(`name`) VALUES (' . $_POST['name'] . ')');
if ($result) {
header('Location: /wp-admin/admin.php?page=menu_custom');
}
}
}
}
add_action('init', start());
и
add_action('plugins_loaded', 'start');