2017-04-03 1 views
0

so muss ich Button oder Link, die nach dem Veröffentlichungsdatum zu aktualisieren.Wie aktualisiere Post Publish Date Zeit auf Klick WordPress

Ich fand dies, aber ich weiß nicht, wie ich es nennen soll.

$time = current_time('mysql'); 

wp_update_post(
    array (
     'ID'   => $id, 
     'post_date'  => $time, 
     'post_date_gmt' => get_gmt_from_date($time) 
    ) 
); 
+0

Sie können prüfen, [http://stackoverflow.com/questions/13114270/wordpress-plugin-how-to- Ändern Sie die Zeit nach dem Datum (http://stackoverflow.com/questions/13114270/wordpress-plugin-how-to-change-the-post-date-time), da Ihr Problem ähnlich ist. – Ninja

Antwort

0

Bitte überprüfen Sie dies:

$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); 

this helps ..

+0

danke, es hat funktioniert –

+0

Ihre Begrüßung :) – Aaron