WP_List_Table查询以按当前日期和时间比较元关键字

时间:2019-06-23 16:25:11

标签: php wordpress

我正在尝试将当前日期和时间与meta键WordPress进行比较,这是值的格式=> 2019-04-18 17:26:00

public static function get_customers($per_page = 30, $page_number = 1) {

    global $wpdb;

    $sql = "SELECT * FROM {$wpdb->prefix}postmeta WHERE `meta_key` = 'datepicker' ";
    if (!empty($_REQUEST['orderby'])) {
        $sql .= ' ORDER BY ' . esc_sql($_REQUEST['orderby']);
        $sql .= !empty($_REQUEST['order']) ? ' ' . esc_sql($_REQUEST['order']) : ' ASC';
    }

    $sql .= " LIMIT $per_page";
    $sql .= ' OFFSET ' . ( $page_number - 1 ) * $per_page;


    $result = $wpdb->get_results($sql, 'ARRAY_A');

    return $result;
}

0 个答案:

没有答案