Hiding GravityKit admin notices
Most GravityKit notices can be dismissed from the notice itself. When one keeps coming back, or you want a class of notice gone for good, which method to use depends on the kind of notice it is.
Dismiss a single notice #
Notices that can be dismissed carry a Dismiss control, and some offer a snooze instead, which brings the notice back later rather than never. A dismissal is stored per user, so a notice you dismissed will still appear for your colleagues.
Deprecated hook notices #
A notice naming a hook, a replacement, and a file and line number is a deprecated hook notice. GravityView raises it when code on your site hooks a name that has been renamed. It appears only while WP_DEBUG is enabled, so turning off debugging on a production site removes it.
To keep debugging on and still silence these, return false from the gk/gravityview/deprecated-hook-notices/register filter:
add_filter( 'gk/gravityview/deprecated-hook-notices/register', '__return_false' );The filter also receives the hook name, its replacement, and the file and line that registered the callback, so you can silence one hook while leaving the rest visible. Hiding the notice does not change any behavior: the old hook still fires and its result is passed into the new one.
Hide one specific notice #
Every GravityKit notice passes through gk/foundation/notices/evaluation/notice before it is shown. Return false for the notice you want gone, and return the value you were given for everything else, so the normal rules still decide the rest:
add_filter(
'gk/foundation/notices/evaluation/notice',
function ( $should_display, $notice ) {
if ( 'the-notice-slug' === $notice->get_slug() ) {
return false;
}
return $should_display;
},
10,
2
);The default value is null, which means “no opinion”: GravityKit then decides as usual. Returning true forces a notice to show even when it otherwise would not, which is rarely what you want.
To find a notice’s slug, log what passes through the filter ($notice->get_slug()) and reload the screen showing the notice. $notice->get_product() tells you which GravityKit product raised it.
Full signatures for both filters, with every parameter: gk/gravityview/deprecated-hook-notices/register and gk/foundation/notices/evaluation/notice.
A separate WordPress message, Function _load_textdomain_just_in_time was called incorrectly, is not a GravityKit notice and is covered here.