Skip to content

Commit cdee595

Browse files
committed
add default-popup-maker mu-plugin
1 parent b773412 commit cdee595

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

default-popup-maker.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Plugin Name: Be API - Default Popup Maker
4+
* Description: Hide Popup Maker filesystem cache alert
5+
* Version: 1.0
6+
* Author: BE API Technical team
7+
* Author URI: https://www.beapi.fr
8+
*/
9+
10+
namespace BEAPI\Plugin_Defaults\Popup_Maker;
11+
12+
add_filter( 'pum_alert_list', __NAMESPACE__ . '\\strip_filesystem_cache_alert', 999 );
13+
14+
/**
15+
* Hide Popup Maker filesystem cache alert
16+
*
17+
* @param array $alerts Popup Maker alerts returned by apply_filters( 'pum_alert_list', [] ).
18+
* @return array
19+
*/
20+
function strip_filesystem_cache_alert( $alerts ) {
21+
if ( empty( $alerts ) || ! is_array( $alerts ) ) {
22+
return $alerts;
23+
}
24+
25+
return array_values(
26+
array_filter(
27+
$alerts,
28+
static function ( $alert ) {
29+
return ! isset( $alert['code'] ) || 'pum_writeable_notice' !== $alert['code'];
30+
}
31+
)
32+
);
33+
}

0 commit comments

Comments
 (0)