Hallo!
Ich brauche mal wieder Hilfe von euch, denn ich kann mit PHP gar nix anfangen...
Kann ich das Plug IN 'Close Old Posts' so umarbeiten, dass nur Posts mit einer bestimmten Kategorie (in meinem Fall Kategorie 3) gelöscht werden?
Falls ihr das PlugIn nicht kennt, hier der Code: (und vielen Dank im voraus!)
<?php
/*
Plugin Name: Close Old Posts
Plugin URI: WordPress › Blog Tool and Publishing Platform
Description: Closes comments on old posts on the fly, without any DB queries. By default it's 14 days, change that setting by editing the plugin file.
Author: Matt Mullenweg
Version: 1.2
Author URI: Matt Mullenweg — aka Photo Matt — on WordPress, Web, Jazz, Life, and Photography
*/
if ( !defined( 'COP_DAYS_OLD' ) )
define( 'COP_DAYS_OLD', 40 ); // close comments after this many days
function close_old_posts( $posts ) {
if ( !is_single() || empty( $posts ) )
return $posts;
if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( COP_DAYS_OLD * 24 * 60 * 60 ) ) {
$posts[0]->comment_status = 'closed';
$posts[0]->ping_status = 'closed';
}
return $posts;
}
add_filter( 'the_posts', 'close_old_posts' );