¿No te ha pasado que has publicado algo con algún error y cuando has querido arreglarlo ya lo había difundido el feed con el fallo?. A mi bastantes veces, sobre todo con los permalinks (lo peor), y luego si lo cambias ya nada evita que tu artículo se publique con un permalink feo o incorrecto en el feed.
Afortunadamente hay soluciones, y esta es tan simple como incluir el siguiente código en el fichero functions.php de tu theme:
/**
* publica más tarde el contenido en el feed
*/
function publica_mas_tarde_en_feed($where) {
global $wpdb;
if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate('d-m-Y G:i');
// valor para la espera y dispositivo
$wait = '5';
// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
// agrega SQL-sytax al $where por defecto
$where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
}
return $where;
}
add_filter('posts_where', 'publica_mas_tarde_en_feed');
Inicio





Pingback: Bitacoras.com