Support Forum
Support › Meta Box Group › Metabox group and admin-ajax.php
I have a page with a fair amount of content using the metabox group plugin (see code below). it seems to hammer admin-ajax with calls on page load. I have all the latest versions, and no other plugins installed. Wondering if you had a work around for this or any ideas what is happening?
$meta_boxes[] = array(
'id' => 'page_title',
'title' => 'Project Page',
'pages' => array( 'page'),
'show' => array(
'relation' => 'OR',
'template' => array( 'tmpl.projects.php'),
),
'fields' => array(
array(
'id' => 'project_item',
'type' => 'group',
'clone' => true,
'max_clone' => 99,
'sort_clone' => true,
'collapsible' => true,
'group_title' => 'Project',
'fields' => array(
array(
'name' => __( 'Link', 'rwmb' ),
'id' => "{$prefix}project_link",
'type' => 'post',
'clone' => false,
'force_delete' => true,
'std' => '',
'post_type' => 'post',
'field_type' => 'select_advanced',
'query_args' => array(
'post_status' => 'publish',
'posts_per_page' => '-1',
)
),
array(
'name' => __( 'Image', 'rwmb' ),
'id' => "{$prefix}project_image_teaser_full",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'clone' => false,
),
array(
'name' => __( 'Portrait Image', 'rwmb' ),
'id' => "{$prefix}project_image_teaser_portrait",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'clone' => false,
),
array(
'name' => __( 'Heading', 'rwmb' ),
'desc' => __( '', 'rwmb' ),
'id' => "{$prefix}project_name",
'type' => 'textarea',
'cols' => 10,
'rows' => 4,
),
),
),
)
);
Hi, sorry for the delay.
The group extension doesn't do anything with Ajax. Can you send me a screenshot of Network tab in the console log?
Here you go console log http://grfk.co.nz/J3FaQS
Error: http://grfk.co.nz/3Jnxmb
Looks like the ajax request comes from the image advanced field. I've just tested your code again and didn't see any problem. Can you please:
- Test with a single image advanced field?
- Probably check what does the server response?
- Check with other PHP code that might causes 505 error?
Thanks for the reply,
— Do you mean just a single instance of the group, or a single image field inside each group instance (as opposed to two images)?
The JS that sends ajax request is in the image advanced field. It queries to get image info from image ID. So, please try with just a single image advanced field. It's not needed to put it inside a group.
No admin-ajax error on just one image advanced field
I went and created some more tests, metabox group does seems to behave very oddly (starts cloning items at certain times) , and maybe this is linked to the above error?
see video http://grfk.co.nz/kVG2Pk
$meta_boxes[] = array(
'id' => 'testing_group',
'title' => 'Testing Group (ignore)',
'pages' => array( 'page'),
'fields' => array(
array(
'id' => 'test_item_test',
'type' => 'group',
'clone' => true,
'max_clone' => 99,
'sort_clone' => true,
'collapsible' => true,
'group_title' => 'Project',
'fields' => array(
array(
'name' => __( 'Image', 'rwmb' ),
'id' => "{$prefix}testing_image_test",
'type' => 'image_advanced',
'max_file_uploads' => 1,
'clone' => false,
),
),
),
)
);
Metabox 4.12.4
Metabox Group 1.2.11
Metabox conditional 1.5
Metabox show hide 1.02
Wordpress 4.8.3
Hey any update on this?
Hi,
I replicated the bug and am working on it. Will update the plugins as soon as I find something. Please wait a little.
By the way, does the ajax issue still happen to you? I see no errors in the video.
Hi, no unfortunately it still:
1. Fails to attach images to the back and front end on update
2. And displays the admin-ajax error
Video here: http://grfk.co.nz/fHHzEU
Can you send me an admin account to check on your website? Please send via the Contact page.
Thanks have sent
I've received it. Will check it soon.
I've just fixed issue of not clearing image_advanced value when cloning a group. Can you please try it on your site to see if it works? I'll release new version when we confirm that.
Nice job, that looks like it fixes the issue of cloning
Still getting the glitchy behaviour of admin-ajax errors and images detaching on the back / front end if I clone a group more than 16 times.