I have created a listing custom post type with various custom fields including an image upload field for the featured image. It used to work before, but whenever I try to add a new listing or update an existing one now by uploading a new image, it says: "Please correct the errors highlighted below and try again.".
When I don't try to upload a new image, I can save the listing. Any help on this issue is highly appreciated!
jquery.min.js?ver=3.6.0:2 Uncaught Error: Syntax error, unrecognized expression: # at se.error (jquery.min.js?ver=3.6.0:2:13639) at se.tokenize (jquery.min.js?ver=3.6.0:2:21650) at se.select (jquery.min.js?ver=3.6.0:2:22477) at Function.se [as find] (jquery.min.js?ver=3.6.0:2:7116) at S.fn.init.find (jquery.min.js?ver=3.6.0:2:25047) at new S.fn.init (jquery.min.js?ver=3.6.0:2:25536) at S (jquery.min.js?ver=3.6.0:2:1051) at e.value (validation.min.js?ver=5.6.7:29:8806) at HTMLFormElement.dispatch (jquery.min.js?ver=3.6.0:2:43064) at v.handle (jquery.min.js?ver=3.6.0:2:41048)
Can you please share the page URL that has the frontend submission form? You can also try to deactivate all plugins except Meta Box, MB extensions and switch to the standard theme of WordPress (2022) and recheck this issue.
Is there a way to send the page URL privately?
I have just deactivated all plugins except for Meta Box and Meta Box AIO and also changed the theme to the default 2022 WordPress theme. However, the issue still exists.
You can share the private info via this contact form https://metabox.io/contact/
I will check it out.
Hi Long Nguyen,
I have sent you the info via the contact form.
You are using the validation
extension to validate the extension of the image uploaded. But this rule only works with two field types
image while your field type is
image_upload. I've changed the field Featured Image to the type
image then I can upload the image and submit the form as well.
Please read more on the documentation https://docs.metabox.io/validation/
Thanks, you made my day!
Another follow-up question: I have removed the field validation and changed the field type to "Image Upload". The design of the field type looks so much better. 🙂
The image upload is working now! For the ID field, I tried _thumbnail_id and _thumbnail_id2, but unfortunately the uploaded image is not set as a featured image. Do you have any idea what the problem could be? You can test it at ourdomain/port/.
Did you already have a chance to look at the featured image issue?
If you want to set the featured image by the custom field, please use the field type
single_image. It saves one image ID to the database like the featured image of WordPress, the data saved of the field type
image_upload is different.
Read more on the documentation https://docs.metabox.io/fields/single-image/
Hi Long Ngyuen,
Ok, I will use the
single_image field type then. 🙂
When I click on the "Add Media" button, nothing happens, but I get the following error message in the console:
media-views.min.js?ver=6.0.3:2 Uncaught TypeError: this.activateMode is not a function at media-views.min.js?ver=6.0.3:2:59600 at cn (embed-core.js?id=d52f4c09a24bf2889838:1:176662) at Function.so (embed-core.js?id=d52f4c09a24bf2889838:1:212941) at n._createModes (media-views.min.js?ver=6.0.3:2:59560) at n.initialize (media-views.min.js?ver=6.0.3:2:58969) at n.initialize (media-views.min.js?ver=6.0.3:2:79858) at n.initialize (media-views.min.js?ver=6.0.3:2:73428) at h.View (backbone.min.js?ver=1.4.1:2:14714) at n.constructor (wp-backbone.min.js?ver=6.0.3:2:2602) at n.constructor (media-views.min.js?ver=6.0.3:2:106836)
Do you have any idea why the issue occurs?
After using the plugin https://wordpress.org/plugins/health-check/
to enable the troubleshooting mode (deactivate all plugins except Meta Box, MB AIO) and I can set the image for the field single_image as well. So it could be a conflicting issue with another plugin. You can try to deactivate all plugins except Meta Box, MB AIO then activate them one by one to find the culprit.
Hi Long Nguyen,
After I removed the ConvertBox script from our website, the image upload via the single_image field works again. However, this image is still not set as a featured image.
I am storing the data in a custom table. Could this be the reason why it is not working? If so, how can I fix this problem?
It would be great if you could add a checkbox to the UI for the featured image. That would make the whole process much easier.
It is not possible to replace the featured image of the post if you save the custom field value to the custom table. Because the featured image of the post has the ID
_thumbnail_id and save value to the default table of WordPress
You can save the field value to the default table instead of the custom table and see if it works.