Question

I have own class which extends WP_List_Table class and everything works just fine but bulk actions have some issue. They performs well (delete the row in the table, change state of the item etc.) however while they reloads it feils with following errors and notices:

Notice: Undefined offset: 0 in /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/functions.php on line 773
Notice: Undefined offset: 0 in /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/functions.php on line 813
Notice: Undefined offset: 0 in /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/functions.php on line 818
Notice: Undefined offset: 1 in /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/functions.php on line 818
Warning: Cannot modify header information - headers already sent by (output started at /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/formatting.php:5081) in /home/www/interier-ricany.cz/www/bonus.interier-ricany.cz/wp-includes/pluggable.php on line 1179

I have find out thet it has to do something with $args of page, I tried to figure out what's wrong with my redirect and nothing found:

public function process_bulk_action() {

        //Detect when a bulk action is being triggered...
        if ( 'delete' === $this->current_action() ) {

            // In our file that handles the request, verify the nonce.
            $nonce = esc_attr( $_REQUEST['_wpnonce'] );

            if ( ! wp_verify_nonce( $nonce, 'sp_smazat_objednavku' ) ) {
                die( 'Go get a life script kiddies' );
            }
            else {
                self::smazat_objednavku( absint( $_GET['customer'] ) );

                        // esc_url_raw() is used to prevent converting ampersand in url to "#038;"
                        // add_query_arg() return the current url$
                        wp_redirect( esc_url_raw(add_query_arg()) );                        
                exit;
            }

        }
//[...]
}

Could you see anything? If needed whole code is here: https://pastebin.com/D5mprA9x

Was it helpful?

Solution

with add_query_arg the first paramater is required and it must be an array when it is alone :

add_query_arg([])

more informations here : http://developer.wordpress.org/reference/functions/add_query_arg

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top