WP Query和WP Mail?

时间:2015-09-17 09:43:09

标签: php mysql wordpress

我不熟悉wp代码有人能告诉我如何执行SQL查询然后触发邮件吗?

我的目标是在确认查询后首先向表格执行查询SELECT * FROM mytable我想触发wp_mail

这是对的吗?

add_filter('wp_mail_content_type',create_function('', 'return "text/html"; ')); 

$email_result = wp_mail('my.email@domain.com', 'Subject', 'Message');

if( $email_result ){//wp_mail() processed the request successfully
    global $wpdb;
    $table_name = $wpdb->prefix . "mytable";

    $ereminders = $wpdb->query( $wpdb->prepare("
        SELECT * FROM $table_name
    ") );
}

0 个答案:

没有答案