WordPressの予約投稿機能は便利ですが、特定のサイト運営方針においてはこの機能を無効化したい場合があります。
例えば、投稿の公開タイミングを厳密に手動で管理したい場合などです。
この記事ではfunctions.phpを使用して予約投稿を無効化する方法を紹介します。
予約投稿を無効化
functions.phpに以下のコードを追加します。| 
					 1 2 3 4 5 6 7 8 9  | 
						add_action('save_post', 'futuretopublish', 99); add_action('edit_post', 'futuretopublish', 99);   function futuretopublish(){   global $wpdb;   $sql = 'UPDATE `'.$wpdb->prefix.'posts` ';   $sql .= 'SET post_status = "publish" ';   $sql .= 'WHERE post_status = "future"';   $wpdb->get_results($sql); }  | 
					
  
  
  
  

コメント