Custom Fields
Re-Envisioned
Support MB Custom Table Can't make WordPress save in custom table

This topic contains 2 replies, has 2 voices, and was last updated by  Anh Tran 2 months ago.

  • Creator
    Topic
  • #14118
    Resolved
    kesit
    Participant

    Hi,
    I have this MB Custom Table ver. 1.1.8.
    My custom table successfully created but when I save my custom post type with custom table, it won’t save in custom table and still save data in usual table.

    Here is my code to create the table:

    add_action( 'init', 'prefix_create_table' );
    function prefix_create_table() {
        if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
            return;
        }
        MB_Custom_Table_API::create( 'xxx_table', array(
                    'konsumen_capsule_id' => 'VARCHAR(20) NOT NULL',
                    'konsumen_prod_pref' => 'TEXT NOT NULL',
                    'konsumen_capsule_1_taste'  => 'TEXT NOT NULL',
                    'konsumen_capsule_1_sensation' => 'TEXT NOT NULL',
                    'konsumen_capsule_1_intent' => 'TEXT NOT NULL',
                    'konsumen_capsule_1_adoptability' => 'TEXT NOT NULL',
                    'konsumen_capsule_2_taste' => 'TEXT NOT NULL',
                    'konsumen_capsule_2_sensation' => 'TEXT NOT NULL',
                    'konsumen_capsule_2_intent' => 'TEXT NOT NULL',
                    'konsumen_capsule_2_adoptability' => 'TEXT NOT NULL',
                    'konsumen_capsule_3_taste' => 'TEXT NOT NULL',
                    'konsumen_capsule_3_sensation' => 'TEXT NOT NULL',
                    'konsumen_capsule_3_intent' => 'TEXT NOT NULL',
                    'konsumen_capsule_3_adoptability' => 'TEXT NOT NULL',
        ));
    }

    and here’s the code to create the metabox:

    https://ghostbin.com/paste/m938q

    Would you mind to point me to a clue to fix this?

    Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #14131

    kesit
    Participant

    Sorry, the above meta box is: https://ghostbin.com/paste/xsoa7

    #14134

    Anh Tran
    Keymaster

    Hi kesit,

    Please make sure all field IDs match the table columns. I see at lease konsumen_id field doesn’t have a column in the table.

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

You must be logged in to reply to this topic.