: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Filters the cache to clear or alter its data.
* @param mixed $cache The cache content.
$cache = apply_filters( 'wpforms_dash_widget_lite_cached_data', $cache ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName
// is_array() detects cached empty searches.
if ( $allow_caching && is_array( $cache ) ) {
$forms = wpforms()->get( 'form' )->get( '', [ 'fields' => 'ids' ] );
if ( empty( $forms ) || ! is_array( $forms ) ) {
foreach ( $forms as $form_id ) {
$count = absint( get_post_meta( $form_id, 'wpforms_entries_count', true ) );
if ( empty( $count ) && empty( $this->settings['display_forms_list_empty_entries'] ) ) {
'title' => get_the_title( $form_id ),
if ( ! empty( $result ) ) {
// Sort forms by entries count (desc).
static function ( $a, $b ) {
return ( $a['count'] > $b['count'] ) ? -1 : 1;
// Transient lifetime in seconds. Defaults to the end of a current day.
$transient_lifetime = $this->settings['transient_lifetime'];
set_transient( $transient_name, $result, $transient_lifetime );
* Use dashboard screen options to make it visible again.
public function hide_widget() {
if ( ! is_admin() || ! is_user_logged_in() ) {
if ( ! isset( $_GET['wpforms-nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['wpforms-nonce'] ) ), 'wpforms_hide_dash_widget' ) ) {
if ( ! isset( $_GET['wpforms-widget'] ) || $_GET['wpforms-widget'] !== 'hide' ) {
$user_id = get_current_user_id();
$metaboxhidden = get_user_meta( $user_id, 'metaboxhidden_dashboard', true );
if ( ! is_array( $metaboxhidden ) ) {
update_user_meta( $user_id, 'metaboxhidden_dashboard', [ 'wpforms_reports_widget_lite' ] );
if ( is_array( $metaboxhidden ) && ! in_array( 'wpforms_reports_widget_lite', $metaboxhidden, true ) ) {
$metaboxhidden[] = 'wpforms_reports_widget_lite';
update_user_meta( $user_id, 'metaboxhidden_dashboard', $metaboxhidden );
$redirect_url = remove_query_arg( [ 'wpforms-widget', 'wpforms-nonce' ] );
wp_safe_redirect( $redirect_url );
* Clear dashboard widget cached data.
public static function clear_widget_cache() {
delete_transient( 'wpforms_dash_widget_lite_entries_by_form' );