Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have this fucntion which is called via Ajax to delete an option based on the name passed in.

function uncheck_package(){
        $element = $_POST['element_value'];

    echo json_encode($element);

        $option = get_option('aisis_options');
            update_option('aisis_options', $option);

add_action( 'wp_ajax_nopriv_uncheck_package', 'uncheck_package' );  
add_action( 'wp_ajax_uncheck_package', 'uncheck_package' );  

the jquery calling this:

          var el = $(this).prev('input[type="checkbox"]');
              url  : 'http://localhost/wordpress/wp-admin/admin-ajax.php',
              type : 'POST',
              data : { 
                  action : 'uncheck_package',
                  element_value : el.val()
              success: function(result){
              error: function(jqXHR, textStatus, errorThrown ){
                console.log(jqXHR, textStatus, errorThrown);

Now What I did so you can see the out put, is created a gist which has the out put of this function being called three consecutive times to delete three different options.

What you will notice is that, the name above the option array that's printed out is no where in that option array, BUT in every other array that option name exists.

So if package_Aisis-Related-Posts-Package-master is deleted in the first call, which it is - its no longer deleted when the function is called again, or a the third time.

The question is, why.

share|improve this question
what resultat you getting from the update_option('aisis_options', $option); call, is it returning false? before the print_r, do another $option = get_option('aisis_options'); to relly see whats saved, insted of listing what you want to save –  Puggan Se Aug 13 '13 at 21:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.