Custom Field as an automatic featured image

Support MB Builder Custom Field as an automatic featured imageResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #40883
    AMXAMX
    Participant

    Hi,

    I am building a site where users will submit frontend forms and selected users will also have the capability to create and edit custom posts through the backend. Some of them will have no WordPress experience and they might not be interested in learning too much about WP and its terminology. So, I want to make things as simple as possible for them.

    I would like one custom field to be saved automatically as the featured image of the CPT. If it is together with other fields, it will be better than the featured image box in the sidebar.

    I have followed the tip from here:
    https://support.metabox.io/topic/use-image-upload-field-to-set-the-featured-image-of-the-post/

    In the Builder I set the field ID to "_thumbnail_id". I tried several types of image/file fields, but the result was always the same: in the post edit screen the existing featured image disappeared and the field with the ID "_thumbnail_id" didn't even appear. I revealed native WordPress custom fields, but that field wasn't there either. The featured image was really deleted from the post.

    What am I missing? How can I automatically convert a file/image field to a featured image? Both in the post edit screen and in submissions. Which type of field is best-suited for it?

    Greetings,
    Tom

    #40891
    PeterPeter
    Moderator

    Hello,

    At first, you should use the field single_image to set the featured image for the post.
    - in the backend, you should disable the standard featured image box of the post type. If the post type is managed by Meta Box, you can go to Meta Box > Post Types > Edit the CPT > Supports tab > Disable option "Thumbnail".
    - in the frontend, it works as it should.

    Let me know how it goes.

    #40900
    AMXAMX
    Participant

    Thank you Peter! It works in post edit screens as expected. I haven't created submission forms yet, but I guess it will be fine now.

    Cheers,
    Tom

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.