Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use admin_email_remind_interval filter in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
August 28, 2022
5 minutes read

admin_email_remind_interval filter

The `admin_email_remind_interval` filter helps you control the interval for admin email reminders. If you return 0 (zero), the “Remind me later” link won’t be displayed.

To use the `admin_email_remind_interval` filter, you need to register it using `add_filter`. You can add this code to the `functions.php` file of your active theme or in a custom WordPress plugin.

We at WePlugins always recommend creating a custom WordPress plugin when using hooks to ensure nothing breaks when you update your WordPress theme in the future.

The example below defines a function `weplugins_modify_admin_email_remind_interval_defaults` which takes one parameter and is registered using `add_filter`. The first parameter `admin_email_remind_interval` is the name of the hook, the second parameter `weplugins_modify_admin_email_remind_interval_defaults` is the name of the function to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times, and the last parameter is the number of arguments (if any) to be passed to the registered function.

Sometimes, you need to remove a registered hook, and you can do this using `remove_filter` to remove the `admin_email_remind_interval` filter.

Parameters

Below is the required parameter to use this hook:

  • $interval: (int) Interval time (in seconds). Default is 3 days.

Live Example

apply_filters('admin_email_remind_interval', int $interval)

Below is an example of how you can use this hook:

Example 1: Modify Admin Email Remind Interval

This example shows how to modify the default interval for admin email reminders.

        function weplugins_modify_admin_email_remind_interval_defaults($interval) {
            // Update the $interval variable according to your website requirements and return this variable. You can modify the $interval variable conditionally too if you want.
            return $interval;
        }
        // add the filter
        add_filter("admin_email_remind_interval", "weplugins_modify_admin_email_remind_interval_defaults", 10, 1);
    

Example 2: Remove Admin Email Remind Interval Hook

To remove a hook callback, use the example below.

        remove_filter("admin_email_remind_interval", "weplugins_modify_admin_email_remind_interval_defaults", 10, 1);
    

Please make sure to provide the same callback function name, priority, and number of arguments while removing the hook callback.

Example 3: Set Custom Interval for Admin Email Reminder

In this example, we set a custom interval for the admin email reminder to 7 days.

        function weplugins_set_custom_admin_email_remind_interval($interval) {
            // Set interval to 7 days (7 * 24 * 60 * 60 seconds)
            $interval = 7 * 24 * 60 * 60;
            return $interval;
        }
        // add the filter
        add_filter("admin_email_remind_interval", "weplugins_set_custom_admin_email_remind_interval", 10, 1);
    

Access Premium WordPress Plugins

Contact Us

If you need customization or have any trouble using this hook, please contact us and we’ll be happy to assist you.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.