• Resolved lothsun

    (@lothsun)


    I am trying to create a custom post type for the sermons on our church website. I want to be able to set something up the will check the folder for new files and if they are found, create a post for them. I have most of it set up except I can’t figure out how to go about checking for the new files automatically. I’m making this so all I have to do is upload the file to the folder and walk away.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Use wp_schedule_event() to execute some function you create. I’m not well versed with what file system functions are available from PHP, but the general idea would be to find all files in a folder newer than the last time the check was run.

    It’s a good idea to store the timestamp of the run since you cannot rely on scheduled events running exactly on time because it takes an actual visitor (or bot) request to trigger a scheduled event.

    Thread Starter lothsun

    (@lothsun)

    That is exactly what I was needing. Thank you for showing me that function.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check for files on page load or specified time each day’ is closed to new replies.