Create Custom Post with PHP - Best Practises

Support MB Custom Post Type Create Custom Post with PHP - Best Practises

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39025
    Macky McCormackMacky McCormack
    Participant

    Hi,

    I am trying to create a custom post using wp_insert_post(), but this requires post_content and my CPT doesn't use this field.

    How do you recommend creating/updating custom posts created with metabox.io custom posts and field groups with PHP? Field group has cloneable group.

    Thanks

    #39031
    PeterPeter
    Moderator

    Hello Macky,

    The function wp_insert_post() requires inserting the post title and content to the post. It is the requirement of a WordPress function so there is nothing we can do with Meta Box.

    If you want to update/create the field value of a post, please take a look at the function update_post_meta() and refer to this topic https://support.metabox.io/topic/error-while-inserting-field_id-in-rwmb_after_save_post/#post-37979

    #39032
    Macky McCormackMacky McCormack
    Participant

    Thanks I'll have a look at those

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