Cara menggunakan hide admin notices wordpress

Skip to content

Table of Contents

  • Post navigation
  • How do I turn off PHP warnings in WordPress?
  • How do I hide warnings and notices in PHP?
  • How do I turn off notices in WordPress?
  • How do I turn off PHP errors?

AitThemes

Block-based WordPress Theme

PHP Warnings and PHP Notices can come from various plugins and might fill up your error log. You can turn them off in your wp-config.php file with these settings:

ini_set['display_errors','Off'];
ini_set['error_reporting', E_ALL ];
define['WP_DEBUG', false];
define['WP_DEBUG_DISPLAY', false];

Post navigation

Rating: 5.0/5. From 3 votes.

Please wait...

This tutorial will show you how to hide PHP warnings and notices in WordPress.

WordPress. How to hide PHP warnings and notices

For example this warning at the frontend:

  1. Log into the Host Control Panel [Cpanel]. Go to File Manager [or you can connect to FTP]:

    Get to the root directory of the website, open wp-config.php file:

  2. In this file, we will search for:

     define['WP_DEBUG', false];
    

    We will replace this piece of codes with:

    ini_set['log_errors','On'];
    ini_set['display_errors','Off'];
    ini_set['error_reporting', E_ALL ];
    define['WP_DEBUG', false];
    define['WP_DEBUG_LOG', true];
    define['WP_DEBUG_DISPLAY', false];
    

    Save the file.

Refresh the page to check the result.

Feel free to check the detailed video tutorial below:

WordPress. How to hide PHP warnings and notices

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket

How do I turn off PHP warnings in WordPress?

Either way, you're looking for the “WP_DEBUG” portion of the wp-config. php file. Click the “Save Changes” button in the top right. Once the file is saved, this will disable the PHP warnings in WordPress.

How do I hide warnings and notices in PHP?

In the current file, search for the line of code error_reporting. There will be a line of Default Value: E_ALL as shown below: Replace this line of code with Default Value: E_ALL & ~E_NOTICE. It will display all the errors except for the notices.

How do I turn off notices in WordPress?

Installation.

Press the Add New button on your WordPress Dashboard Plugins screen..

Search for “Hide Admin Notices”.

Press Install Now and then Activate..

The plugin will work straight away; there is nothing more to do!.

How do I turn off PHP errors?

To turn off or disable error reporting in PHP, set the value to zero. For example, use the code snippet:

Every time you access the WordPress desktop it is common that you find some messages at the top of your screen, they are the WordPress administration notices.

  • Why WordPress administration notices are important
  • Types of WordPress administration prompts
    • Achievement notice [green border]
    • Warning notice [yellow border]
    • Information notice [blue border]
    • Error notice [red border]
    • WooCommerce notices [purple border]
  • What are management notices useful for?
  • The problem of too many WordPress administration warnings
    • Sales and marketing notices
    • Notices of minor issues
    • Recurrent notices
    • Data tracking notices
  • How to control and hide WordPress administration notices
    • How to completely hide WordPress administration notices
      • With a code
      • With a plugin
    • How to selectively hide WordPress administration notices
      • Hide warnings only to non-administrator users
        • With a code
        • With plugins
      • Let each user decide which notices to hide
  • How to create WordPress administration notices
    • Create administration notices with code
      • Warning notice on the desktop to all non-dischargeable users
      • Error warning in the comment screen for users with author profile and discardable
    • Create administration notices with a plugin

Why WordPress administration notices are important

They are typically used to alert the user of important information, such as updates, warnings or errors.

Although you may think they are annoying, these admin notices can actually be quite useful in the right circumstances.

Admin prompts can guide you on tasks you need to perform, such as updating plugins or WordPress itself, how to fix bugs, and even how to fix technical issues.

However, it is also true that there are developers who abuse this tool, and sometimes WordPress admin notices are overused, turning them into something annoying and useless, because when there are too many notices the user tends not to read any of them.

In this article I want to show you the different types of administration notices there are, what each one is for, and how to manage them correctly, even hiding those that are not important.

Types of WordPress administration prompts

There are 4 types of situations that WordPress, plugins and themes can inform you about via admin notices.

Each of these types of notices are displayed in a block with a white, blue or yellow background, with different colored borders, which can help you quickly identify what type of notice it is.

Achievement notice [green border]

When you manage to make a change in WordPress, either in some settings or in the publication of content, activate a plugin, etc., this type of administration notice is displayed, which you will identify by the green border.

Warning notice [yellow border]

This notice can already be considered as an alert, and it appears when the user is warned about some issue.

It is the type of admin warning you will see when a plugin is not working properly, updates are available, and other situations where WordPress, plugins and themes feel they should warn you of a pending action.

These warning notices are distinguished by the yellow border.

Information notice [blue border]

This type of notice is purely informational and you can ignore them most of the time. They are distinguished by the blue border.

Error notice [red border]

Error messages appear when something goes wrong with your website. They are shown with a red border.

WooCommerce notices [purple border]

In addition to the standard WordPress ads we’ve seen before, recently other plugins have started using this feature to launch warning messages to their users.

One of them is WooCommerce, which usually displays its ads with the border in purple, lilac, or whatever you call it.

What are management notices useful for?

Apart from WordPress’ own admin notices, you can also use them as a way to contact your users for important issues if you are a plugin or theme developer, or even create custom admin notices on your own website to inform users of any important site issues or warnings. We’ll look at how to make them later.

The problem of too many WordPress administration warnings

Despite the obvious benefits of alerting users to important information about WordPress via admin alerts, every now and then the debate arises about the actual usefulness of these alerts for users. Especially when it comes to theme and plugin alerts.

In particular, there are several types of notices that can be particularly annoying…

Sales and marketing notices

Some developers use the notices to promote and sell other products from the WordPress desktop, which is often really annoying.

This is always the case to cross-sell pro versions of plugins and themes, and especially terrible on dates like Christmas or Black Friday, when they come to practically hijack WordPress admin screens.

Notices of minor issues

One of the main reasons why management warnings become annoying to users is when developers add warnings that are not really necessary.

For example, warnings about background processes that can be dismissed are usually irrelevant – and annoying – to most users.

Recurrent notices

Then there is the excess of repetitive warnings from some plugins, reminding you of this or that setting, especially when you can’t dismiss those warnings.

Any admin prompt without an icon or button to close it is an intrusion into the users’ workspace.

And the worst ones are those that, even if you close them, keep popping up again and again.

Data tracking notices

Also, more and more developers are adding notices to users offering to track and process their plugin usage data, statistics, etc.

This can be suspicious for anonymous users accessing the WordPress administration for minor issues.

How to control and hide WordPress administration notices

At this point you’re probably already thinking about whether there will be a way to control, even remove WordPress admin notices, leaving the useful ones and hiding the unnecessary ones.

And yes, we have several ways to achieve this, with and without plugins.

How to completely hide WordPress administration notices

If you are sure about everything that needs to be done on your website, one option – which I do not recommend – could be to completely hide all WordPress administration notices, no matter what color they are.

We have 2 ways to achieve this:

With a code

If you are already decided, add this code to the end of the functions.php file of the active child theme or to your customizations plugin:

/* Hide all notices WP */ add_action['admin_head', 'wphelp_hide_notices_wp']; function wphelp_hide_notices_wp[] { ?> .notice { display: none;}

Bài mới nhất

Chủ Đề