Metabox group and admin-ajax.php
- This topic has 21 replies, 2 voices, and was last updated 7 years, 5 months ago by
Anh Tran.
-
AuthorPosts
-
October 27, 2017 at 8:34 AM #7196
grafik
ParticipantI 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, ), ), ), ) );
October 30, 2017 at 3:56 PM #7214Anh Tran
KeymasterHi, 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?
October 31, 2017 at 3:54 AM #7222grafik
ParticipantHere you go console log http://grfk.co.nz/J3FaQS
Error: http://grfk.co.nz/3Jnxmb
October 31, 2017 at 11:48 AM #7225Anh Tran
KeymasterLooks 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?October 31, 2017 at 2:14 PM #7229grafik
ParticipantThanks 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)?
October 31, 2017 at 2:15 PM #7230Anh Tran
KeymasterThe 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.
November 1, 2017 at 3:58 AM #7238grafik
ParticipantNo 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.3November 2, 2017 at 1:22 AM #7253grafik
ParticipantHey any update on this?
November 3, 2017 at 5:08 PM #7264Anh Tran
KeymasterHi,
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.
November 4, 2017 at 1:24 PM #7275grafik
ParticipantHi, no unfortunately it still:
1. Fails to attach images to the back and front end on update
2. And displays the admin-ajax errorVideo here: http://grfk.co.nz/fHHzEU
November 4, 2017 at 3:12 PM #7276Anh Tran
KeymasterCan you send me an admin account to check on your website? Please send via the Contact page.
November 6, 2017 at 3:29 AM #7288grafik
ParticipantThanks have sent
November 6, 2017 at 1:01 PM #7294Anh Tran
KeymasterI've received it. Will check it soon.
November 8, 2017 at 11:15 AM #7312Anh Tran
KeymasterI'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.
November 9, 2017 at 1:54 PM #7338grafik
ParticipantNice 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.
-
AuthorPosts
- The topic ‘Metabox group and admin-ajax.php’ is closed to new replies.