NO BUG: Metabox Relationship Queries Stopped Working in Bricks

Site is updated to Bricks 1.9 and the latest Metabox AIO version.

On my production site I have 2 different Metabox Relationship queries. Both have stopped working and return no data in the Bricks Editor or on the frontend. They were working maybe 2 weeks or so ago for sure but I am not sure when they stopped working (or what Bricks version it was).

One of the relationship queries is for a FAQ CPT related to a Services CPT.

The relationships are visible and can be edited when I edit the Service CPT in the WordPress Admin. So Metabox has no problems with them.

I have cleared the cache repeatedly and disabled it and it still doesn’t work.

Using the Query Monitor plugin I looked for queries executed on the page for the FAQ CPT (called ess_faqs). I found this one:

SELECT wp_posts.ID
FROM wp_posts
INNER JOIN wp_mb_relationships AS mbr
ON (mbr.to = wp_posts.ID
AND mbr.type = 'services-faq'
AND mbr.from IN (962))
WHERE 1=1
AND ((wp_posts.post_type = 'ess_faqs'
AND (wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'private')))
GROUP BY `mbr_services-faq_from`, wp_posts.ID
ORDER BY mbr.order_from

If you look at the query you can see that it will fail since the Group By has a field in it mbr_services-faq_from that does not exist in the SELECT.

The funny thing is I have a development site with virtually the same website. It has the same Bricks and Metabox data and versions. This site works. When I enable the Query Monitor Plugin on it and view the queries they are slightly different.

SELECT wp_posts.* , mbr.from AS `mbr_services-faq_from`
FROM wp_posts
INNER JOIN wp_mb_relationships AS mbr
ON (mbr.to = wp_posts.ID
AND mbr.type = 'services-faq'
AND mbr.from IN (962))
WHERE 1=1
AND ((wp_posts.post_type = 'ess_faqs'
AND (wp_posts.post_status = 'publish'
OR wp_posts.post_status = 'private')))
GROUP BY `mbr_services-faq_from`, wp_posts.ID
ORDER BY mbr.order_from

As you can see there are more fields in the SELECT which allows the GROUP BY to work and the query to execute properly.

What would cause Bricks on the production site to produce slightly different queries that would fail to execute?

Also the other relationship query I have on the site is on a different page and use different CPTs. It has the same SQL statement issue where some fields are missing from the SELECT statement and results in no records being returned.

Thanks

1 Like

I can confirm this is happening on my production site too.
Bricks Builder v1.9
Meta Box AIO v1.23.0

Although I have not used the Query Monitor plugin.

Small note: my relationship is post ↔ post reciprocal, not between two different CPTs in the ‘To’ and ‘From’ panes, but I still get this same anomaly.

@Tom I’d be interested in what Bricks version is running on that dev server, any chance you can double check?

Hi @Tom ,

Thanks for your email.
As per my reply, best if you could clone it as a staging site so we can troubleshoot by deactivating plugins etc.

Hi @Scott ,
Could you please provide a temp admin to help@bricksbuilder.io?
Alternatively, please try to check if any plugin or custom code causing the issue.

Kindly check in wp-admin if the relationship are connected. Not just when editing the post.

Regards,
Jenn

All plugins are at their latest version on my Dev site same as the production site. (Bricks 1.9 and MetaBox AIO 1.2.3) thats what has me confused about the whole thing. BTW my relationships are not reciprocal.

@itchycode Okay I will clone the site and send you a DM.

Regarding the Related FAQ Column in the Admin for my Services CPT. I enabled that on my dev site and it is fill with my FAQ items for my Services (unlike the production site). I don’t understand though as the FAQ items are visible when I edit the Service on the Production site (and now the cloned site) and I can add and remove them.

Anyways I did clone the production server and sent you the link via DM.

Thanks

1 Like

I can also attest that this is happening to a few of our websites. We have tried everything, including deactivating every single plugin except Metabox AIO and clearing all cache, including server-side and Cloudflare, and nothing we do fixes this issue. We are getting similar error codes with the Query Monitor plugin, as Tom shared above.

All of our pages with FAQ and Review Sections are not showing anything as if the fields were empty, but they are not.

We’ve also posted this issue on the Metabox Forum, but there have been no updates yet.

Well this is awkward timing as I was just trying to set up Meta Box relationships and display with Bricks after updating to 1.9, but couldn’t get to work properly. Perhaps this is why. I’ll have to test again on an older version or after this bug is fixed then. :frowning:

1 Like

Hey @Tom, hey @Scott, hey @2damaxmarketing, hey @d19dotca,

as already requested by Jenn… can you guys please send some temporary credentials to the sites where it is not working for you to help@bricksbuilder.io? That way the whole support team is able to have a look at it – not just Jenn. :slight_smile:

I was not yet able to reproduce the issue.

Best,

André

I did DM ItchyCode but I also just replied to help email with the cloned site you can play around with to look into this problem further.

Hey @Tom,

thanks for the staging site.

The object cache (MU-plugin) seems to break the functionality. That’s not a Bricks issue as even Meta Box itself is not able to correctly fetch the connected items (resulting in an empty admin column).

After disabling it everything works as expected:

@Scott, @2damaxmarketing, @d19dotca: Are you using something similar?

Best,

André

I’ve run into the same issue. Has anybody found a solution or workaround?

I’m using the Redis Object Cache plugin, is that what you feel the root cause is here? Why would this only be an issue after updating Bricks to 1.9 though and not having updated recently any Meta Box versions?

Hey @d19dotca,

as Meta Box itself is not able to correctly show the related posts in the admin column I don’t think Bricks is the issue in this case.

If you can provide me with a staging site where the identical setup works with a previous Bricks version I‘m happy investigate this further.

Best,

André

Thanks Aslotta, I see that disabling Object Cache does fix the problem. So, it looks to be most likely a metabox issue or a bug in object cache (it was updated Aug 27).

Confirming same issue across two Meta Box relationships.

Hey @FranklyCo,

are you also using Object Cache? If so… can you confirm that it works with the Object Cache being disabled?

Best,

André

My site is hosted on Cloudways which comes bundled with Object Cache, I disabled it and Metabbox Relationships still are not displaying.

Hey @bolks,

can you please try to switch to another theme and see if the admin column (you have to enable them in your relationship settings in Meta Box) correctly outputs the connected posts there? I am pretty sure it won’t.

It’d be best if you contacted Meta Box support regarding this issue.

Best,

André

OK, Sorry for the delayed response.

Sorry no staging server credentials but I did do this:

I rolled this back to Bricks 1.8.6 with an old Cloudways image and the issue is there.
I disabled Object Cache plugin (mu-plugin) inside the Bricks 1.8.6 version and without changing anything else, it (my reciprocal relationship) does immediately show up in both the Admin column and also on the front-end (where it is supposed to be from the Bricks template).

I too serve this site from Cloudways and they require this plugin Object Cache plugin (mu-plugin) in order for their (I think) Redis services to work correctly for object caching and speed (I :heart: Cloudways :heart:).

Can anyone duplicate this issue with another theme or theme system? That would break it away from just Bricks and into Meta Box’s court.

What are your thoughts?

2 Likes

Yes, can confirm this is Cloudways OP Cache. Apparently Meta Box’s team has tried reaching out to OP Cache author…

2 Likes