: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* @copyright Copyright (c) 2023, Code Atlantic LLC
if ( ! defined( 'ABSPATH' ) ) {
* PUM_Utils_Cron constructor.
public function __construct() {
add_filter( 'cron_schedules', [ $this, 'add_schedules' ] );
add_action( 'wp', [ $this, 'schedule_events' ] );
* Registers new cron schedules
* @param array $schedules
public function add_schedules( $schedules = [] ) {
// Adds once weekly to the existing schedules.
'display' => __( 'Once Weekly', 'popup-maker' ),
public function schedule_events() {
private function weekly_events() {
if ( ! wp_next_scheduled( 'pum_weekly_scheduled_events' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'pum_weekly_scheduled_events' );
private function daily_events() {
if ( ! wp_next_scheduled( 'pum_daily_scheduled_events' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'daily', 'pum_daily_scheduled_events' );