Custom Fields
Re-Envisioned
Support MB Settings Page Problem with default value of field types

This topic contains 5 replies, has 3 voices, and was last updated by  Truong Giang 1 year, 4 months ago.

  • Creator
    Topic
  • #7713
    Resolved
    Hazmi
    Participant

    Hi,

    i’m using latest plugin version. Today i noticed, that my custom fields of types (text, datetime, .. and maybe other) have a default value of empty brackets “[]” – if i setup “std” to another default value, nothing is happen – still the brackets. If i change value to something and make save, the value is correctly saving..

    Next, i have noticed, that developer console only on settings page has “Uncaught ReferenceError: QTags is not defined”.

    
    add_filter( 'mb_settings_pages', 'mb_v2018' );
    function mb_v2018( $settings_pages ) {
        $settings_pages[] = array(
            'id'          => 'v2018',
            'menu_title'  => __('Settings',TEXTDOMAIN),
            'parent'    => 'edit.php?post_type=vol2018'
        );
        return $settings_pages;
    }

    $meta_boxes[] = array(
    
        'id' => 'vol_options',
        'title' => __('Options',TEXTDOMAIN),
        'settings_pages' => 'v2018',
            'fields' => array(
            array(
                'name'    => __('Something', TEXTDOMAIN ),
                'id'    => "{$prefix}something",
                'type'  => 'text',
                'std' => 'test'
            )
        )
    )
Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #7726

    Anh Tran
    Keymaster

    Hi Hazmi,

    Regarding the 1st problem, can you please describe steps to replicate it? I couldn’t replicate on my side. But my guess is the saved value in the DB. If you already saved values of your fields into an option, then when you add a new field which has name already registered before, then the value might be taken from the previous one. Not sure if that’s the case, but you can try remove the option in the DB and try again.

    Regarding the problem with QTag, do you have any wysiwyg field in your settings page? QTags is available only for the editor. With the code above, I can’t see anything in the console:

    View post on imgur.com

    #7730

    Hazmi
    Participant

    Hi,

    1/ i have a setting page from the code i have posted, every custom field for user input (text, datetime, ..) i create has an “[]” as default value :/ and param “std” with my value doesn’t work

    A new problem for me here – custom field “taxonomy” on setting page doesn’t save my data (“taxonomy_advanced” is ok) :/

    2/ no, i haven’t any wysiwyg

    #7752

    Truong Giang
    Participant

    Hi there,

    Taxonomy field doesn’t save data to post meta or options, it is used for assigning a taxonomy to a post. You should use taxonomy_advanced instead. Read more here: https://docs.metabox.io/fields/taxonomy/#data

    For other problems, please wait for us to check it.

    Thanks.

    #8517

    Hazmi
    Participant

    Hi,

    any progress with this (2 months)?

    #8521

    Truong Giang
    Participant

    Hi there,

    Sorry for late reply. I checked many times but can’t get your problem. Did you try with 2017 theme and all plugins are deactivated?

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.