Javascript 如何在单击wordpress时更新发布后日期时间

Javascript 如何在单击wordpress时更新发布后日期时间,javascript,php,jquery,html,wordpress,Javascript,Php,Jquery,Html,Wordpress,所以我需要做的按钮或链接,将更新后发布日期 我找到了这个,但我不知道怎么称呼它 $time = current_time('mysql'); wp_update_post( array ( 'ID' => $id, 'post_date' => $time, 'post_date_gmt' => get_gmt_from_date( $time ) ) ); 请检查以下内容: $m

所以我需要做的按钮或链接,将更新后发布日期

我找到了这个,但我不知道怎么称呼它

$time = current_time('mysql');

wp_update_post(
    array (
        'ID'            => $id,
        'post_date'     => $time,
        'post_date_gmt' => get_gmt_from_date( $time )
    )
);
请检查以下内容:

$mypost = array();
$mypost['ID'] = 1; // the post ID you want to update
$mypost['post_date'] = $your_date; // uses 'Y-m-d H:i:s' format
wp_update_post($mypost);
希望这有帮助。

您可以检查,因为您的问题与此类似。