Поддержка Проблемы и решения Подскажите, почему не обновляет update_option?

  • Добрый день форумчане, я стараюсь научится писать плагины под WP! Набираюсь опыта и слизываю что-то с других проектов, делая под свои нужды. Вот так я и слизал этот код с плагина Interkassa от морковина!
    Но у меня не работает обновление в базу данных! Когда я что-то ввожу в поле, то информация в базе данных не обновляется! Подскажите в чем может быть ошибка!

    <?php
    /*
    Plugin Name: Check Tetxt
    Plugin URI: http://www.exemple.com
    Description: Плагин для проверки уникальности текста по средствам API с сайта text.ru
    Version: 1
    Author: Proof
    Author URI: http://www.exemple.com
    */
    /*  Copyright 2013  Proof  (email: proof2mail@gmail.com)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function p_verifi_text() {
    echo "<h3>1111111</h3>";
    }  
    
    function p_add_admin_menu() {
        add_options_page('Настройки Check Text', 'Check Text', 8, 'check_text', 'p_admin_page');
    }
    //Формируем страницу администрирования
    function p_admin_page() {
        echo "<h1>Страница настроек Check Text плагина</h1>";
        echo p_change_key();
    
        //Пользовательский ключ
        add_option('user_key', '');
    
    }
    
    function p_change_key()
    {
        //Применение изменений
        if(isset($POST['press_buttom']))
        {
            if(function_exists('current_user_can') &&
             !current_user_can('manage_options'))
                die (_e('Хакер', 'proof_err'));
    
            if(function_exists('check_admin_referer'))
            {
                check_admin_referer('p_setup_form');
            } 
    
            //Получаем и записываем в БД ключ
            $user_key = strip_tags($POST['user_key']);
            update_option('user_key', $user_key);
    
        }
    
        //Формирование формы
        echo "
                <form name='p_user_key_form' method='post' action='".$_SERVER['PHP_SELF']."?page=check_text&updated=true'>
             ";
    
        if(function_exists('wp_nonce_field'))
        {
            wp_nonce_field('p_setup_form');
        }
        echo "
             Введите ключ:.
             <input type='text' name='user_key' value='".get_option('user_key')."' size='40'/>
             <p><input type='submit' name='press_buttom' value='Сохранить'/></p></form>
             ";
    }
    
    add_action('post_submitbox_misc_actions' ,'p_verifi_text');
    add_action('admin_menu' ,'p_add_admin_menu'); 
    
    ?>
  • Тема «Подскажите, почему не обновляет update_option?» закрыта для новых ответов.