WooCommerce Code Reference

WC_Admin_Notices
in package

WC_Admin_Notices Class.

Table of Contents

$core_notices  : array
Array of notices - name => callback.
$notices  : array
Stores notices.
add_custom_notice()  : mixed
Add a custom notice.
add_maxmind_missing_license_key_notice()  : mixed
Add MaxMind missing license key notice.
add_min_version_notice()  : mixed
Add notice about minimum PHP and WordPress requirement.
add_notice()  : mixed
Show a notice.
add_notices()  : mixed
Add notices + styles if needed.
add_redirect_download_method_notice()  : mixed
Add notice about Redirect-only download method, nudging user to switch to a different method instead.
base_tables_missing_notice()  : mixed
Notice about base tables missing.
get_notices()  : array
Get notices
has_notice()  : bool
See if a notice is being shown.
hide_notices()  : mixed
Hide a notice if the GET variable is set.
init()  : mixed
Constructor.
install_notice()  : mixed
If we have just installed, show a message with the install pages button.
legacy_shipping_notice()  : mixed
Show a notice asking users to convert to shipping zones.
maxmind_missing_license_key_notice()  : mixed
Display MaxMind missing license key notice.
no_shipping_methods_notice()  : mixed
No shipping methods.
output_custom_notices()  : mixed
Output any stored custom notices.
redirect_download_method_notice()  : mixed
Notice about Redirect-Only download method.
regenerating_lookup_table_notice()  : mixed
Notice shown when regenerating thumbnails background process is running.
regenerating_thumbnails_notice()  : mixed
Notice shown when regenerating thumbnails background process is running.
remove_all_notices()  : mixed
Remove all notices.
remove_notice()  : mixed
Remove a notice from being displayed.
reset_admin_notices()  : mixed
Reset notices for themes when switched or a new version of WC is installed.
secure_connection_notice()  : mixed
Notice about secure connection.
simplify_commerce_notice()  : mixed
Simplify Commerce is no longer in core.
store_notices()  : mixed
Store notices to DB
template_file_check_notice()  : mixed
Show a notice highlighting bad template files.
theme_check_notice()  : mixed
Show the Theme Check notice.
update_notice()  : mixed
If we need to update the database, include a message with the DB update button.
uploads_directory_is_unprotected_notice()  : mixed
Notice about uploads directory begin unprotected.
wp_php_min_requirements_notice()  : void
Notice about WordPress and PHP minimum requirements.
is_plugin_active()  : bool
Wrapper for is_plugin_active.
is_ssl()  : bool
Determine if the store is running SSL.
is_uploads_directory_protected()  : bool
Check if uploads directory is protected.

Properties

$core_notices

Array of notices - name => callback.

private static array $core_notices = array('install' => 'install_notice', 'update' => 'update_notice', 'template_files' => 'template_file_check_notice', 'legacy_shipping' => 'legacy_shipping_notice', 'no_shipping_methods' => 'no_shipping_methods_notice', 'regenerating_thumbnails' => 'regenerating_thumbnails_notice', 'regenerating_lookup_table' => 'regenerating_lookup_table_notice', 'no_secure_connection' => 'secure_connection_notice', WC_PHP_MIN_REQUIREMENTS_NOTICE => 'wp_php_min_requirements_notice', 'maxmind_license_key' => 'maxmind_missing_license_key_notice', 'redirect_download_method' => 'redirect_download_method_notice', 'uploads_directory_is_unprotected' => 'uploads_directory_is_unprotected_notice', 'base_tables_missing' => 'base_tables_missing_notice')

Methods

add_custom_notice()

Add a custom notice.

public static add_custom_notice(string $name, string $notice_html) : mixed
Parameters
$name : string

Notice name.

$notice_html : string

Notice HTML.

Return values
mixed

add_maxmind_missing_license_key_notice()

Add MaxMind missing license key notice.

public static add_maxmind_missing_license_key_notice() : mixed
Tags
since
3.9.0
Return values
mixed

add_min_version_notice()

Add notice about minimum PHP and WordPress requirement.

public static add_min_version_notice() : mixed
Tags
since
3.6.5
Return values
mixed

add_notice()

Show a notice.

public static add_notice(string $name[, bool $force_save = false ]) : mixed
Parameters
$name : string

Notice name.

$force_save : bool = false

Force saving inside this method instead of at the 'shutdown'.

Return values
mixed

add_redirect_download_method_notice()

Add notice about Redirect-only download method, nudging user to switch to a different method instead.

public static add_redirect_download_method_notice() : mixed
Return values
mixed

legacy_shipping_notice()

Show a notice asking users to convert to shipping zones.

public static legacy_shipping_notice() : mixed
Tags
todo

remove in 4.0.0

Return values
mixed

maxmind_missing_license_key_notice()

Display MaxMind missing license key notice.

public static maxmind_missing_license_key_notice() : mixed
Tags
since
3.9.0
Return values
mixed

redirect_download_method_notice()

Notice about Redirect-Only download method.

public static redirect_download_method_notice() : mixed
Tags
since
4.0
Return values
mixed

regenerating_lookup_table_notice()

Notice shown when regenerating thumbnails background process is running.

public static regenerating_lookup_table_notice() : mixed
Tags
since
3.6.0
Return values
mixed

regenerating_thumbnails_notice()

Notice shown when regenerating thumbnails background process is running.

public static regenerating_thumbnails_notice() : mixed
Return values
mixed

remove_notice()

Remove a notice from being displayed.

public static remove_notice(string $name[, bool $force_save = false ]) : mixed
Parameters
$name : string

Notice name.

$force_save : bool = false

Force saving inside this method instead of at the 'shutdown'.

Return values
mixed

reset_admin_notices()

Reset notices for themes when switched or a new version of WC is installed.

public static reset_admin_notices() : mixed
Return values
mixed

simplify_commerce_notice()

Simplify Commerce is no longer in core.

public static simplify_commerce_notice() : mixed
Tags
deprecated
3.6.0

No longer shown.

Return values
mixed

uploads_directory_is_unprotected_notice()

Notice about uploads directory begin unprotected.

public static uploads_directory_is_unprotected_notice() : mixed
Tags
since
4.2.0
Return values
mixed

wp_php_min_requirements_notice()

Notice about WordPress and PHP minimum requirements.

public static wp_php_min_requirements_notice() : void
Tags
since
3.6.5

is_plugin_active()

Wrapper for is_plugin_active.

protected static is_plugin_active(string $plugin) : bool
Parameters
$plugin : string

Plugin to check.

Return values
bool

is_uploads_directory_protected()

Check if uploads directory is protected.

protected static is_uploads_directory_protected() : bool
Tags
since
4.2.0
Return values
bool