Using WordPress ‘core_auto_updates_settings()’ PHP function

The core_auto_updates_settings() WordPress PHP function displays the auto-update settings of your WordPress site.

Usage

To use this function, simply call it wherever you need to show the auto-update settings:

core_auto_updates_settings();

Parameters

This function does not take any parameters.

More information

See WordPress Developer Resources: core_auto_updates_settings()

Examples

Displaying Auto-Update Settings in a Dashboard Widget

In this example, we create a dashboard widget that displays the auto-update settings.

// Add the widget
add_action('wp_dashboard_setup', 'my_custom_dashboard_widget');

function my_custom_dashboard_widget() {
    wp_add_dashboard_widget('custom_help_widget', 'Auto-Update Settings', 'custom_dashboard_help');
}

function custom_dashboard_help() {
    // Display the auto-update settings
    core_auto_updates_settings();
}

Showing Auto-Update Settings in a Custom Admin Page

Here, we create a custom admin page and display the auto-update settings.

// Add the admin page
add_action('admin_menu', 'my_custom_admin_page');

function my_custom_admin_page() {
    add_menu_page('Auto-Update Settings', 'Auto-Updates', 'manage_options', 'auto-updates', 'display_auto_updates_settings');
}

function display_auto_updates_settings() {
    // Display the auto-update settings
    core_auto_updates_settings();
}

Displaying Auto-Update Settings on a Post or Page

This example uses a shortcode to display the auto-update settings on a post or page.

// Add the shortcode
add_shortcode('display_auto_updates', 'shortcode_auto_updates_settings');

function shortcode_auto_updates_settings() {
    // Start output buffering
    ob_start();

    // Display the auto-update settings
    core_auto_updates_settings();

    // Return and clean the output buffer
    return ob_get_clean();
}

Use the shortcode [display_auto_updates] in your post or page editor.

Displaying Auto-Update Settings in a Theme Template

Here, we display the auto-update settings in a theme template file.

// In your theme template file (e.g., page.php)

function my_custom_template_function() {
    // Display the auto-update settings
    core_auto_updates_settings();
}

my_custom_template_function();

Displaying Auto-Update Settings in a Plugin

In this final example, we’ll show the auto-update settings in a custom plugin.

// In your plugin file

add_action('admin_init', 'my_plugin_auto_updates');

function my_plugin_auto_updates() {
    // Display the auto-update settings
    core_auto_updates_settings();
}