Paylaştığım ilanların örnek 30 gün sonra silinmesini istiyorum. Böyle bir eklenti var mı?
Yada yapabilecek olan var mı?
Wordpress otomatik içerik silme eklentisi var mı?
10
●107
- 18-09-2021, 22:36:49
- 18-09-2021, 22:41:04functions.php dosyasına şu kodları ekleyeceksiniz. 30 günden eski postları siliyor (muş)softmax adlı üyeden alıntı: mesajı görüntüle
/** * Add monthly interval to the schedules (since WP doesnt provide it from the start) */ add_filter('cron_schedules','cron_add_monthly'); function cron_add_monthly($schedules) { $schedules['monthly'] = array( 'interval' => 2419200, 'display' => __( 'Once per month' ) ); return $schedules; } /** * Add the scheduling if it doesnt already exist */ add_action('wp','setup_schedule'); function setup_schedule() { if (!wp_next_scheduled('monthly_pruning') ) { wp_schedule_event( time(), 'monthly', 'monthly_pruning'); } } /** * Add the function that takes care of removing all rows with post_type=post that are older than 30 days */ add_action( 'monthly_pruning', 'remove_old_posts' ); function remove_old_posts() { global $wpdb; $wpdb->query($wpdb->prepare("DELETE FROM wp_posts WHERE post_type='post' AND post_date < DATE_SUB(NOW(), INTERVAL 30 DAY);")); } - 18-09-2021, 22:41:26
- 18-09-2021, 22:41:33buyrun bu işinizi görür
https://wordpress.org/plugins/post-expirator/ - 18-09-2021, 22:43:40Boşuna eklenti yükleyip sitenizi zorlamayın. Size verdiğim kodu deneyin. Tertemiz eklentisiz.softmax adlı üyeden alıntı: mesajı görüntüle
