Forum Replies Created
-
AuthorPosts
-
SAS
ParticipantOur issue was the we've checked in the filter callback if we're on the page in the WP backend where the metabox we've defined should be displayed or not.
If not, we've returned the array we've received through the metabox filter hook as is, without adding our metabox and fields. The intention was to add our metabox and fields only on the settings pages where we need it.
This works fine, but some field types like select_advanced doing some ajax calls to retrieve the selectable options, in our case back then because we've used the field without the options parameter, instead we used it to offer posts to select. In that case, metabox does an ajax call to retrieve and populate the select_advanced field options with the available posts. I assume the post_field does an ajax call as well and works similar.
Since we kind of registered the metabox only on that specific settings page, the metabox and it's fields weren't defined when doing the ajax call.
We've fixed it by removing our check if we're on the page on which we need the metabox.
Here's an example which might help:
private function __construct() { add_filter( 'mb_settings_pages', [ $this, 'settings_page'], 0, 1 ); add_filter( 'rwmb_meta_boxes', [ $this, 'settings'], 0, 1 ); } public function settings_page( $settings_pages ) { // add our settings pages return $settings_pages } public function settings( $meta_boxes ) { /* * This broke it when having a field type which is doing ajax calls. Fields which aren't doing ajax calls are not affected. */ //======================================= if ( ! empty( $_GET['page'] ) ) { if ( 'my-settings-page' <> $_GET['page'] ) { return $meta_boxes; } } //======================================= $meta_boxes[] = [ 'id' => 'my_settings', 'title' => 'Login Settings', 'settings_pages' => 'my-settings-page', 'tab' => 'login_settings', 'fields' => [ [ 'id' => 'login_page_id', 'name' => _x( 'Login page', 'admin', 'demo' ), 'desc' => _x( 'Choose your default login page.', 'admin', 'demo' ), 'type' => 'post', 'post_type' => 'any', 'field_type' => 'select_advanced', 'placeholder' => _x( 'Default WordPress login page', 'admin', 'demo' ) ] ] ]; return $meta_boxes; }Hope that helps!
SAS
ParticipantThanks for refering to another topic. Am i right that this issue is a known one for more than a year?
SAS
ParticipantHi,
is there any update on this topic?!
Because the topic ist marked as resolved. But the problem is still there.
Image does not work, please visit: https://imgur.com/kLIz1MySAS
ParticipantHi there,
is there any update on this topic?!
SAS
ParticipantThank you a lot 🙂
SAS
ParticipantImage does not work please visit https://imgur.com/akxP6F1
SAS
ParticipantHi Ahn,
we've figured it out.
In our code we don't add our metabox code to your filter array on admin pages where it shouldn't be displayed.
It seems like that your AJAX call triggers the filter execution and because we're not adding our code on admin-ajax.php it breaks somehow your ajax call.
We've workaround it and all is working for us.
Thanks for assistance, we're really appreciate your effort!
SAS
ParticipantHi Ahn,
Thank you for looking into this! I really appreciate it!
I reinstalled Meta Box and cleared the browser cache. I also created a very new WP site, still no joy.
The ajax call ends as a 400 (badrequest).I don't think it is a caching issue. It also is not a general ajax issue, since other ajax calls working as expected.
I've checked with others in my team, they experiencing the same issue. In the select box it displays "The results couldn't be loaded", once i change the "field_type" from "select_advanced" to "select" all is working, but i've mentioned that earlier in our conversation.
Not sure if this might help you to sort this out, but we're using this with your "settings page extension" implemented through.
Please advise.
Thank you!
Best,
JohnOctober 23, 2019 at 2:50 PM in reply to: ✅(Repeatable?) Block over certain content length crashes #16663SAS
ParticipantHi Anh,
unfortunately you can not sort the items in a repeatable group.
And the Conditional Logic does not fit in the MB Blocks too.Any solutions for this?!
SAS
ParticipantHi Anh,
unfortunately, some fields are still not displayed correctly. E.g. "Images" and "Colors". Also, "Button Group" is not saved correctly. If I choose something and save the page, the selected button is still checked, but if I reload the page, the selected button is no longer selected.
We use the latest version 1.0.4 and MB Blocks plugin individually.
Can you help?
SAS
ParticipantThanks for considering this as a future feature!
In some projects, we have lots of tabs and hundreds of settings and it's not very convenient to click through all tabs to look for possible issues. It would be a great improvement.
Besides this issue (at least for me), awesome work, awesome framework! Keep up the good work!
-
AuthorPosts