我在 wp-content/theme/mytheme 文件夹中创建了一个新文件。
在文件中我编写了简单的查询
global $wpdb;
$insert= $wpdb->insert('wp_test', array(
'orderID' =>$_GET['orderID'],'amount'=>$_GET['amount'],'acceptance'=>$_GET['ACCEPTANCE'],'status'=>$_GET['STATUS'],
));
我收到错误“调用未定义的函数”。我必须在该文件中包含文件吗?
试试这个:在文件开头包含 wp-load.php 。
文件位于主题文件夹中。
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'],
));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)