Custom Fields
Re-Envisioned
Support MB Relationships Database Error on Relationships after update to latest MetaBox AIO and WP 5.5.1

  • Creator
    Topic
  • #22434
    Mauro
    Participant

    Hello,
    On all my relationships I get this error, with no change on my code that worked fine before. This is not limited to this relationship, it happens on all of them. Other then the error, the query results are returned correctly and shown on my pages so I’m assuming there is one query fired per relationship that messes things up. Can you help troubleshooting this?
    I’m assuming the issue is at “AND mbr.to IN ()”.

    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 IN (‘post’, ‘page’, ‘attachment’, ‘itinera’ at line 1]
    SELECT wp_posts.ID , mbr.to AS mbr_hotel_to_city_to FROM wp_posts INNER JOIN wp_mb_relationships AS mbr ON (mbr.from = wp_posts.ID AND mbr.type = ‘hotel_to_city’ AND mbr.to IN ()) WHERE 1=1 AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’, ‘itinerary’, ‘top_activity’, ‘suggested_hotel’, ‘restaurant’, ‘city’, ‘shopping’, ‘room’, ‘hotel_activity’, ‘hotel_service’, ‘hotel’, ‘booking’) AND (wp_posts.post_status = ‘publish’ OR wp_posts.post_author = 2 AND wp_posts.post_status = ‘private’) GROUP BY mbr_hotel_to_city_to, wp_posts.ID ORDER BY mbr.order_to

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #22444
    Long Nguyen
    Moderator

    Hi,

    Please follow this guide to know how to create the staging site https://www.wpbeginner.com/wp-tutorials/how-to-create-staging-environment-for-a-wordpress-site/.

    Then share the credentials (Admin site and FTP account) via this form https://metabox.io/contact/ and let me know where the code stored, I will help you to debug this case.

    #22448
    Mauro
    Participant

    Hello, I shared the details for the staging site through the contact form as requested. Please confirm you received the data.
    Thanks! 🙂
    Mauro.

    #22449
    Mauro
    Participant

    Oh almost forgot! The code that defines relationships is in:
    wp-content/plugins/mundana-itineraries/classes/MundanaItineraries_MetaBoxes.php on line 258 (function register_relationships).

    The code that retrieves data is in the same directory, in the file MundanaItineraries.php on line 495 (method get_related_to) and 527 (method get_related_from).

    In the theme this is used in several places, here is an example:
    wp-content/themes/mundana/template-parts/content-hotel.php

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