1

I have php code that is generating a random number (to use in an array). This is only working on Dev but not on Staging. My guess is because of caching... Is there a way of turning off caching for this 1 page?

<?php
      $rand = mt_rand(0,4);

      $video_list = ['video_url', 'video_2_url', 'video_3_url', 'video_4_url', 'video_5_url'];
      $image_list = ["image", "image2", "image3", "image4", "image5"];
      $video_url = $video_list[$rand];
      $image_url = $image_list[$rand];

      $tile_data = array(
        "color_scheme" => get_sub_field('color_scheme'),
        "image_url" => get_sub_field($image_url),
        "image_alt" => get_sub_field('title'),
        "video_url" => get_sub_field($video_url),
        "right_content" => get_sub_field('right_content'),
      );
    ?>
tomsmithweb
  • 371
  • 2
  • 6
  • 20
  • I'm voting this up as it's not a duplicate to the question posted by Tim. Mainly because that question doesn't relate to PHP at all and WordPress being WordPress doesn't always play nice with PHP headers (as per the "duplicate" question). Sorry, Tim. – WPZA Dec 20 '18 at 22:08
  • Have you read this previous SO answer that was marked as a solution? https://stackoverflow.com/questions/13640109/how-to-prevent-browser-cache-for-php-site – pastaleg Dec 20 '18 at 22:11

0 Answers0