get_the_contentで受け取る内容によって(文字カウント数)その記事自体を自動的に削除したいです。
現在試したfunction.php
PHP
1function custom_delete_posts($post_id) { 2 $content = get_the_content(); 3 $cnt_content = mb_strlen(strip_tags($content)); 4 $force_delete = false; 5 6 if($cnt_content < 32){ 7 wp_delete_post( $post_id, $force_delete ); 8 } 9} 10add_action('delete_post', 'custom_delete_posts');
何か良い方法があればご教授ください。
回答1件
あなたの回答
tips
プレビュー