call_widget_update example

$is_updating_widget_template = (
            isset( $_POST[ 'widget-' . $id_base ] )
            &&
            is_array( $_POST[ 'widget-' . $id_base ] )
            &&
            preg_match( '/__i__|%i%/', key( $_POST[ 'widget-' . $id_base ] ) )
        );
        if ( $is_updating_widget_template ) {
            wp_send_json_error( 'template_widget_not_updatable' );
        }

        $updated_widget = $this->call_widget_update( $widget_id ); // => {instance,form}         if ( is_wp_error( $updated_widget ) ) {
            wp_send_json_error( $updated_widget->get_error_code() );
        }

        $form     = $updated_widget['form'];
        $instance = $this->sanitize_widget_js_instance( $updated_widget['instance']$id_base );

        wp_send_json_success( compact( 'form', 'instance' ) );
    }

    /* * Selective Refresh Methods */
Home | Imprint | This part of the site doesn't use cookies.