$wpdb->insert() is giving error undefined function

后端 未结 3 452
-上瘾入骨i
-上瘾入骨i 2021-01-15 14:51

I have created a new file inside wp-content/theme/mytheme folder.

Inside the file I have written simple query

global $wpdb;
    $insert= $wpdb->i         


        
3条回答
  •  旧时难觅i
    2021-01-15 15:43

    Try this : include wp-load.php at beginning of file.

    File is located at theme folder.

    require_once('../../../wp-load.php');    //<-----please include this
    
    global $wpdb;
        $insert= $wpdb->insert('wp_test', array(
        'orderID' =>$_GET['orderID'],'amount'=>$_GET['amount'],'acceptance'=>$_GET['ACCEPTANCE'],'status'=>$_GET['STATUS'],
        ));
    

提交回复
热议问题