我正在处理一个插件,我需要查询wordpress数据库中的自定义表,我正在使用此代码,但它不输出任何内容。
/**
* Plugin Name: My Plugin
* Plugin URI: http://www.domian.com
* Description: Complete engine for www.mydomian.com
* Version: 1.0.0
* Author: Bradley Fletcher
* Author URI: http://www.domian.net
* License: GPL2
*/
add_action('admin_menu', 'mrq');
function mrq() {
add_menu_page('Partners', 'My Removals Quote', 'administrator', 'my-plugin-settings', 'mrq_settings_page', 'dashicons-admin-generic', '21', 'myremovalsquote');
}
function mrq_settings_page() {
if (is_user_logged_in()) {
global $wpdb;
$customers = $wpdb->get_results("SELECT partner_id, partner_name, email_address, active FROM partners WHERE active ='yes' ORDER BY partner_id ASC");
echo "<table>";
foreach($customers as $customer) {
echo "<tr>";
echo "<td>".$customer->partner_id."</td>";
echo "<td>".$customer->partner_name."</td>";
echo "</tr>";
}
echo "</table>";
} else {
echo "Sorry, only registered users can view this information";
}
}
&#13;