• I need to schedule my WordPress themes to automatically switch based on the date. Currently, four times a year. What is the best way to do this?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Use wp_schedule_single_event(). The callback that is triggered can call switch_theme() and then schedule the next change. Scheduled events rarely occur exactly on schedule, they tend to occur slightly after the scheduled time. If you regularly add a fixed time span to schedule the next event, like 91.3125 days, the time to switch will tend to creep forward. While it will take a long time before the creep is noticeable, you might consider creating a specific date string for the switch, like “1-4-17”, then converting it into a time stamp for the scheduling.

Viewing 1 replies (of 1 total)
  • The topic ‘Switch WordPress Theme on Certain Dates’ is closed to new replies.