regex = 'wp_cache_flush\(\)'; foreach ( $iterator as $file ) { $this->check_file( $file ); } if ( empty( $this->_matches ) ) { $this->set_status( 'success' ); $this->set_message( 'Use of wp_cache_flush() not found.' ); return; } // Show relative paths in output. $relative_paths = array_map( function ( $file ) use ( $wp_content_dir ) { return str_replace( $wp_content_dir . '/', '', $file ); }, $this->_matches ); $this->set_status( 'warning' ); $this->set_message( 'Use of wp_cache_flush() detected in ' . implode( ', ', $relative_paths ) ); } }