Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/11/2013, 00:14
wayward
(Desactivado)
 
Fecha de Ingreso: enero-2004
Mensajes: 136
Antigüedad: 20 años, 3 meses
Puntos: 0
Problema Hook/Cron

Hola a todos.

He creado esta pequeña función para modificar la fecha de los post cada hora:

Código PHP:
Ver original
  1. Hi.
  2.  
  3. I have this fuction in my fuctions.php
  4.  
  5.  
  6.  
  7.     <?php
  8.     if ( !wp_next_scheduled('re-post2') ) {
  9.        wp_schedule_event( time(), 'hourly', 'rep-post2' );
  10.     }
  11.    
  12.     function repostads() {
  13.         global $wpdb;
  14.      $querystr = "
  15.        UPDATE $wpdb->posts
  16.        INNER JOIN $wpdb->repost
  17.        ON $wpdb->posts.ID = $wpdb->repost.post_id
  18.        AND $wpdb->repost.DIA_FINAL >= NOW()
  19.        AND $wpdb->repost.ESTADO = 'OK'
  20.         SET $wpdb->posts.post_date = NOW()
  21.          ";
  22.     }
  23.     add_action ( 're-post2', 'repostads' );
  24.          ?>
  25.  
  26. I try to insert the query code in a sample page, and works fine, but when I insert in  functions.php don´t make nothing.
  27.  
  28. what´s the error?
  29.  
  30. thanks

La query la he probado y funciona correctamente, pero sin embargo cuando la inserto en functions.php y aunque el WP_CRON la reconoce, cuando se ejecuta el CRON no hace absolutamente nada.

¿Donde puede estar el error? ¿Alguna idea?

Un saludo.