# boxzilla/3.4.8/src/admin/migrations/3.1-cookie-option.php

Boxzilla – WordPress Popup Builder, version 3.4.8. 25 lines.

- Page: https://pluginprobe.com/plugins/boxzilla/3.4.8/code/src/admin/migrations/3.1-cookie-option.php
- Raw: https://pluginprobe.com/plugins/boxzilla/3.4.8/raw/src/admin/migrations/3.1-cookie-option.php
- Modified: 2025-03-24T08:35:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/boxzilla/3.4.8/code/src/admin/migrations/3.1-cookie-option.php#L10-L20`.

```php
<?php

defined('ABSPATH') or exit;

$posts = get_posts([ 'post_type' => 'boxzilla-box' ]);

if (! empty($posts)) {
    foreach ($posts as $post) {
        $settings = get_post_meta($post->ID, 'boxzilla_options', true);

        if (! is_array($settings)) {
            continue;
        }

        // translate from days to hours
        $new_value = intval($settings['cookie']) * 24;

        // store in new location
        $settings['cookie'] = [
            'dismissed' => $new_value,
        ];
        update_post_meta($post->ID, 'boxzilla_options', $settings);
    }
}

```
