- This topic has 1 reply, 2 voices, and was last updated 2 years ago by .
Over the past few months I have been using MB Settings to store a few site-values. Specifically, I used it to store a page-url that has a certain shortcode.
I then used that url to show a link in the backend (when editing the post), because it was used to open that page with a query-var ?posthash=90beec18daf4ea8f9b2a9ce755c94046, so users can email links to a formhash, instead of a formid which is easily guessed or incremented.
In the callback for the rwmb_meta_boxes for that CPT-settings I pulled up the
rwmb_meta( 'fieldname' , array( 'object_type' => 'setting' ) , 'option_name' )and that worked.
But now, it returns NULL, instead of the value. I know there a value in there, because I've had to spend some time debugging and eventually changed it to
get_option( 'option_name' )['fieldname'](I used a little more sophisticated method than that, but roughly the same result) and it's fine again.
What's really tripping me is that it worked before, but I now have to change it, receiving reports from client that things stopped working when updating something else. I hate to say it, but sometimes things seem to break for no apparent reason.
Shouldn't this work (getting existing settings via rwmb_meta() inside another settings declaration callback) or am I doing something wrong?
- You must be logged in to reply to this topic.