Upgraded to AIO, now meta fields won't display unless free MB is activated
Support › Meta Box AIO › Upgraded to AIO, now meta fields won't display unless free MB is activatedResolved
- This topic has 11 replies, 3 voices, and was last updated 2 days, 2 hours ago by
Peter.
-
AuthorPosts
-
May 11, 2025 at 11:03 AM #48221
Max Elman
ParticipantThis happened across many sites today. Changed from the free plugin and a few premium extensions to AIO but now custom fields no longer show on the frontend templates where I had them coded with rwmb_meta. Activating the free plugin restores everything and the content shows again.
Why would I need both plugins installed for custom fields to display?
May 12, 2025 at 10:23 PM #48225Peter
ModeratorHello Max,
Thanks for reaching out.
Basically, you can use only one plugin Meta Box AIO to get all features of Meta Box plugins, including Meta Box single (free) plugin.
Please ensure that you have the latest version of Meta Box AIO 2.1.1 on your site and recheck the issue.
May 12, 2025 at 10:25 PM #48226Max Elman
ParticipantYes, I am using Meta Box AIO 2.2.0
May 12, 2025 at 11:29 PM #48230Peter
ModeratorPlease share your site credentials by submitting this form https://metabox.io/contact/
I will take a look.Thank you.
May 13, 2025 at 12:14 AM #48231Max Elman
ParticipantI now see the problem - we had this legacy code in a helper plugin:
// Avoid Undefined Function Error when Meta Box is not active. if ( ! function_exists( 'rwmb_meta' ) ) { function rwmb_meta( $key, $args = '', $post_id = null ) { return false; } }
Removing the code fixed the problem.
I see many mentions of that snippet still online - perhaps AIO can be edited to better deal with that code if present.
May 14, 2025 at 9:37 PM #48254Peter
ModeratorThanks for sharing the solution. That issue is noted in the documentation https://docs.metabox.io/functions/rwmb-meta/#why-does-my-site-crash-when-i-deactivate-meta-box
Have a nice day!
May 14, 2025 at 10:19 PM #48257Max Elman
ParticipantOk. Is there a version of this code that works with the AIO plugin? This fallback function only works with the base plugin.
Ideally I’d like a function that works with AIO and also protects the site if AIO is deactivated.
May 21, 2025 at 12:35 AM #48300Max Elman
ParticipantHello - I'd like a fallback function that still works with AIO. Would this work?
if ( !function_exists( 'rwmb_meta' ) && !in_array( 'meta-box-aio/meta-box-aio.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { function rwmb_meta( $field_id, $args = '', $object_id = null ) { if ( null === $object_id ) { $object_id = get_the_ID(); } return get_post_meta( $object_id, $field_id, true ); } }
May 21, 2025 at 9:17 AM #48302Anh Tran
KeymasterThe problem is that Meta Box AIO loads Meta Box at
init
hook (with priority -5). If you put the snippet to definerwmb_meta
function in your theme'sfunctions.php
, then it will load **before**, which defines an emptyrwmb_meta
function.This method was usually used for themes that are sold like on ThemeForest, to prevent errors of undefined function
rwmb_meta
when they haven't installed Meta Box yet.In your case, I'd recommend removing that snippet, and it will work fine.
May 21, 2025 at 10:30 PM #48304Max Elman
ParticipantOK. I'm still interested in a fallback function if AIO is disabled - so that CPT data is still displayed. Should my function above work for that?
May 27, 2025 at 11:26 PM #48331Max Elman
ParticipantCan you reply regarding my snippet above please? Thank you
May 28, 2025 at 9:56 PM #48338Peter
ModeratorHello Max,
The plugin Meta Box is now included in the Meta Box AIO source, so I think you don't need to use the snippet code to get the fallback function. If you prefer to use the custom code, you are welcome to add it to your site, but we won't support the custom code if it causes any issues there.
I hope that makes sense.
-
AuthorPosts
- You must be logged in to reply to this topic.