/**
 * When the post is saved, saves our custom data.
 *
 * @since 0.1.0
 *
 * @param int $post_id The ID of the post being saved.
 *
 * @return void
 */
function bf_save_page_prerender_metabox_data($post_id)
{
    /*
     * We need to verify this came from our screen and with proper authorization,
     * because the save_post action can be triggered at other times.
     */
    // Check if our nonce is set.
    if (!isset($_POST['bf_mb_nonce'])) {
        return;
    }
    // Verify that the nonce is valid.
    if (!wp_verify_nonce($_POST['bf_mb_nonce'], 'bf_mb_save')) {
        return;
    }
    // If this is an autosave, our form has not been submitted, so we don't want to do anything.
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Check the user's permissions.
    if (isset($_POST['post_type']) && !array_key_exists($_POST['post_type'], BF()->post_types)) {
        return;
    }
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    /* OK, it's safe for us to save the data now. */
    // Make sure that it is set.
    if (!isset($_POST['bf_next_page'])) {
        delete_post_meta($post_id, '_bf_page_prerender');
        return;
    }
    // Sanitize user input.
    $prerender = sanitize_text_field($_POST['bf_next_page']);
    // Update the meta field in the database.
    update_post_meta($post_id, '_bf_page_prerender', $prerender);
}
<?php

/**
 * @package   Behavior Flow/Metabox
 * @author    ThemeAvenue <*****@*****.**>
 * @license   GPL-2.0+
 * @link      http://themeavenue.net
 * @copyright 2014 ThemeAvenue
 */
// If this file is called directly, abort.
if (!defined('WPINC')) {
    die;
}
global $post;
$post_types = BF()->post_types;
$pt_slugs = array();
$ordered = array();
foreach ($post_types as $pt_slug => $pt_name) {
    array_push($pt_slugs, $pt_slug);
    if (!array_key_exists('archive', $ordered)) {
        $ordered['archive'] = array();
    }
    $ordered['archive']["archive_{$pt_slug}"] = $pt_name;
}
$args = array('post_type' => $pt_slugs, 'posts_per_page' => 500, 'post_status' => 'publish');
$pages = new WP_Query($args);
$value = isset($post) && is_object($post) && is_a($post, 'WP_Post') ? get_post_meta($post->ID, '_bf_page_prerender', true) : '';
foreach ($pages->posts as $page) {
    if (!array_key_exists($page->post_type, $ordered)) {
        $ordered[$page->post_type] = array();
    }
                    continue;
                }
                $pt_object = get_post_type_object($post_type);
                if (is_null($pt_object)) {
                    continue;
                }
                if (true === $pt_object->public) {
                    $screens[$post_type] = $pt_object->labels->name;
                }
            }
            $this->post_types = apply_filters('bf_post_types', $screens);
        }
    }
}
/**
 * The main function responsible for returning the one Behavior_Flow
 * Instance to functions everywhere.
 *
 * Use this function like you would a global variable, except without needing
 * to declare the global.
 *
 * @since 0.1.0
 * @return object Behavior_Flow
 */
function BF()
{
    return Behavior_Flow::instance();
}
// Get Behavior Flow Running
BF();