Taxonomy_MetaData icon indicating copy to clipboard operation
Taxonomy_MetaData copied to clipboard

Values missing when using wp-large-options

Open lmartins opened this issue 10 years ago • 1 comments

Hi,

I've managed to get everything working, except when I add wp-large-options. Once I do, the field still shows on the category management but the values won't be saved or shown of the front-end.

Any ideias?

<?php

if( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

if ( ! function_exists( 'cmb2_attached_posts_fields_render' ) ) {
    require_once WPMU_PLUGIN_DIR . '/cmb2-attached-posts/cmb2-attached-posts-field.php';
}

if ( ! class_exists( 'Taxonomy_MetaData_CMB2' ) ) {
    require_once( WPMU_PLUGIN_DIR . '/Taxonomy_MetaData/Taxonomy_MetaData_CMB2.php' );
}

add_filter( 'cmb2_meta_boxes', 'mw_cmb2_categories' );
/**
 * Define the metabox and field configurations.
 *
 * @param  array $meta_boxes
 * @return array
 */
function mw_cmb2_categories( array $meta_boxes )
{
    // Start with an underscore to hide fields from custom fields list
    $prefix = '_cmb2_';

    $meta_box = array(
        'id'            => $prefix . 'banner_metabox',
        'title'         => __( 'Banner Details', 'wip' ),
        'show_on'       => array( 'key' => 'options-page', 'value' => array( 'unknown', ), ),
        'show_names'    => true, // Show field names on the left
        'fields'        => array(
            array(
                'name' => __( 'Category Image', 'wip' ),
                'id' => $prefix . 'category_image',
                'type' => 'file',
                'allow' => array( 'attachment' ) // limit to just attachments with array( 'attachment' )
            ),
        )
    );

     // (Recommended) Use wp-large-options
     require_once( WPMU_PLUGIN_DIR . '/wp-large-options/wp-large-options.php' );
     $overrides = array(
         'get_option'    => 'wlo_get_option',
         'update_option' => 'wlo_update_option',
         'delete_option' => 'wlo_delete_option',
    );

    /**
     * Instantiate our taxonomy meta class
     */
    $cats = new Taxonomy_MetaData_CMB2( 'category', $meta_box, __( 'Category Settings', 'taxonomy-metadata' ), $overrides );

}

lmartins avatar Feb 08 '15 17:02 lmartins

I'm also facing same issue. Everything works fine on localhost but when website is moved to live server, field stops working. None of the value gets saved.

sachittandukar avatar Jun 08 '15 00:06 sachittandukar