Table 'local.wp_mb_relationships' doesn't exist

Support MB Relationships Table 'local.wp_mb_relationships' doesn't existResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #49675
    aryanrajaryanraj
    Participant

    Hi, Created a relationship between two post types, both uses custom table with prefix but i don't see wp_mb_relationships. it is not created after creating relationship and showing error.

    WordPress database error: [Table 'local.wp_mb_relationships' doesn't exist]
    SELECT <code>from</code> FROM wp_mb_relationships WHERE <code>to</code>=1111 AND <code>type</code>='user_is_member' ORDER BY order_to
    
    WordPress database error: [Table 'local.wp_mb_relationships' doesn't exist]
    SELECT <code>from</code> FROM wp_mb_relationships WHERE <code>to</code>=1111 AND <code>type</code>='user_is_member' ORDER BY order_to
    
    WordPress database error: [Table 'local.wp_mb_relationships' doesn't exist]
    SELECT <code>from</code> FROM wp_mb_relationships WHERE <code>to</code>=1111 AND <code>type</code>='user_is_member' ORDER BY order_to
    
    WordPress database error: [Table 'local.wp_mb_relationships' doesn't exist]
    SELECT <code>from</code> FROM wp_mb_relationships WHERE <code>to</code>=1111 AND <code>type</code>='user_is_member' ORDER BY order_to
    

    The selector shows but it saving the data because table is not present. I don't think i have deleted this table.
    Using visual editor but code is this.

    <?php
    add_action( 'mb_relationships_init', 'your_prefix_register_relationships' );
    
    function your_prefix_register_relationships() {
        MB_Relationships_API::register( [
            'id'          => 'user_is_member',
            'from'        => [
                'post_type'   => 'person',
                'object_type' => 'post',
                'field'       => [
                    'add_new' => false,
                ],
            ],
            'to'          => [
                'post_type' => 'member',
            ],
            'reciprocal'  => false,
            'delete_data' => false,
        ] );
    }
    #49677
    aryanrajaryanraj
    Participant

    i don't see it is creating this table wp_mb_relationships. how to fix it?

    #49678
    PeterPeter
    Moderator

    Hello,

    Thanks for reaching out.

    It looks like the table wp_mb_relationships was created and deleted, then Meta Box marked it as created by creating the option mbr_table_created and set value to 1. Please access the database, table wp_options and delete the option mbr_table_created to fix the issue.

    Let me know how it goes.

    #49679
    aryanrajaryanraj
    Participant

    oh, i don't remember deleting this table but the fix worked. mark this as solved.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.