我想知道最后一次发布日期是由用户编写的,下面是我编写的代码,但它不起作用:
function get_user_last_post_date( $user_id ) {
$args = array(
\'post_author\' => $user_id,
\'post_type\' => \'any\',
\'post_status\' => \'publish\',
\'posts_per_page\' => 1,
\'order\' => \'DESC\',
\'orderby \' => \'post_date\'
);
$latest_posts = new WP_Query( $args );
$last_date = \'\';
if ( $latest_posts->have_posts() ) {
$last_date = $latest_posts;
}
return $last_date;
}