• I am trying to refresh the front page after a scheduled post published.

    add_action('future_to_publish', 'do_stuff', 10, 1);
    function do_stuff( $in ) {
    //part 1
    $f = fopen( dirname(__FILE__).'log1.log', 'a' );
      fwrite( $f, "\nBefore\n" );
      fwrite( $f, print_r($in, true) );
      fwrite( $f, "\nAfter\n" );
      fclose( $f );
    //part 1 ends
    //part 2
    redirect('index.php');
    //part 2 ends
    }
    
    function redirect($loc){
    	echo "<script>window.location='".$loc."'</script>";
    }

    The part 1 works perfectly but part 2 don’t.

    Any help Please…

  • The topic ‘Scheduled post published event future_to_publish’ is closed to new replies.