MB Relationships WordPress database error

Support MB Relationships MB Relationships WordPress database error

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44981
    Michele SchembriMichele Schembri
    Participant

    Hi, I am using MB Blocks to link two CPTs, Operator, & Regulator. Here is how I am defining the Relationship:

    MB_Relationships_API::register([
            'id'   => 'operator_to_regulator',
            'from' => [
                'object_type' => 'post',
                'post_type'   => 'operator',
                'meta_box'    => [
                    'title' => 'Is regulated by:',
                ],
            ],
            'to'   => [
                'object_type' => 'post',
                'post_type'   => 'regulator',
                'field'       => [
                    'query_args' => [
                        'post_status' => array('publish', 'draft', 'private')
                    ],
                ],
                'meta_box'    => [
                    'title' => 'Regulates the following operators:',
                ],
            ],
        ]);
    

    Here's the error I am getting:

    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 1=1 AND wp_posts.post_type = 'regulator' AND ((wp_posts.post_statu' at line 2]
    SELECT wp_posts.* , mbr.from FROM wp_posts INNER JOIN wp_mb_relationships AS mbr ON (mbr.to = wp_posts.ID AND mbr.type = 'operator_to_regulator' AND mbr.from IN ()) WHERE 1=1 AND wp_posts.post_type = 'regulator' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'auto-draft' OR wp_posts.post_status = 'private')) GROUP BY mbr.from, wp_posts.ID ORDER BY mbr.order_from

    I am using:
    PHP 8.1.0
    WordPress 6.2.4
    MB Relationships 1.11.3

    Any help would be greatly appreciated.

    Thanks!

    #45004
    PeterPeter
    Moderator

    Hello,

    I don't see any issue with the relationship code. Please share your site credentials via this contact form https://metabox.io/contact/
    I will take a look.

    #46037
    Michele SchembriMichele Schembri
    Participant

    Hi,

    sorry for the delay. This issue is only occurring on my local environment, and I don't believe I can share that, however it's holding me from continuing development.

    If it helps I use MySQL 8.0.27.

    Thanks.

    #46055
    PeterPeter
    Moderator

    Hello Michele,

    Can you please migrate your local site to an online staging site with the same environment and share the credentials so I can check the issue?

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