0

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

2

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

  • thanks a lot! solved the notices, but still the warning. It looks like every file has UTF-8 without BOM encoding – kybernaut.cz Apr 3 '17 at 12:33
  • 1
    prepare_items is called in the middle of HTML output then it's not the good place to do a redirection. try to do it before the start of the output – mmm Apr 3 '17 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.