Custom Fields
Re-Envisioned
Support MB Relationships Trying to create a relationship ends in SQL Error

  • Creator
    Topic
  • #12572
    Vee Jay
    Participant

    This is the error I get with debug mode on:

    WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE from=1 AND type='post2conf' ORDER BY order_from' at line 1]
    SELECT to FROM WHERE from=1 AND type='post2conf' ORDER BY order_from

    This is the code i’m trying to use:

    add_action( 'mb_relationships_init', function () {
        MB_Relationships_API::register( array(
            'id'   => 'post2conf',
            'from' => array(
                'object_type' => 'post',
                'admin_column' => true,  // THIS!
            ),
            'to'   => array(
                'object_type' => 'post',
                'post_type'    => 'conference',
    
                'admin_column' => 'after title', // THIS!
            ),
        ) );
    } );

    While i’m a it, I wanted to know if there was a way to create a many to many relationship.
    I’d like to allow my user to link different custom post type between them (conferences, publications, posts, people (not users), etc.)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #12591
    crispedge
    Participant

    Got inside wrong topic

    #12622
    Anh Tran
    Keymaster

    Hi Vee,

    Looks like no relationships table is created. Can you remove your code first, try to deactivate and re-activate the plugin? Just to make sure the plugin creates table successfully.

    #12634
    Vee Jay
    Participant

    I tried that but I get the same thing.

    #12635
    Anh Tran
    Keymaster

    Can you check the WordPress database to see if the mb_relationships table is created?

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