WP_LIST_TABLE批量操作通知和警告

时间:2017-04-03 作者:Karolína Vyskočilová

我有自己的类,它扩展了WP\\u List\\u Table类,一切都很好,但批量操作有一些问题。他们的表现很好(删除表中的行、更改项目状态等),但重新加载时会出现以下错误和注意事项:

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
我发现这和$args 在page中,我试图找出重定向的错误,但没有找到任何结果:

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;
            }

        }
//[...]
}
你能看到什么吗?如果需要,完整代码在此处:https://pastebin.com/D5mprA9x

1 个回复
最合适的回答,由SO网友:mmm 整理而成

具有add_query_arg 第一个参数是必需的,单独使用时必须是数组:

add_query_arg([])
更多信息请参见:http://developer.wordpress.org/reference/functions/add_query_arg

相关推荐

在管理员帖子wp-list-table之前/之后添加内容

我知道有两个钩子可以在分类法wp列表前后添加内容。是否有操作可在编辑上的post type wp list表格后添加内容。php页面?$taxonomy列表:add_action( \'category\' . \'_pre_add_form\', \'copy_above_form\' ); function copy_above_form( $taxonomy ) { echo \'<p>Above the WP-List-Table</p>\';&#x