Is it possible to use the custom table to save all general post information?

Support MB Custom Table Is it possible to use the custom table to save all general post information?Resolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #18945
    Infolu OfficialInfolu Official
    Participant

    Hello I would like to know if it is possible to use the mb custom table to create a custom table and save all the information in a post in this single table ignoring the primary information that is saved in the table in wp_posts absolutely everything in the customized table?

    #18955
    Long NguyenLong Nguyen
    Moderator

    Hi,

    It is impossible and easier when you create MB Custom Table and use custom fields as the post type support (post content, excerpt, featured image ...) then save the custom fields to the custom table.

    You can use the hook remove_post_type_support to remove the post type support and only shows the custom fields.

    For more information, please follow the documentation https://docs.metabox.io/extensions/mb-custom-table/

    #18978
    Infolu OfficialInfolu Official
    Participant

    Hi, I think I was not very clear in my question, what I would like is for the post to be saved completely in the customized table, including ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_content_filtered, post_parent, guid, menu_order, post_type, post_mime_type, comment_count.

    In other words, instead of saving the default fields in wp_post save together in wp_custom_table.

    #18984
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Yes, I know the question you are talking about. You can follow this guide to know how to save the post data to another table
    https://stackoverflow.com/questions/49439231/wordpress-inserting-posts-in-another-custom-table
    https://wordpress.stackexchange.com/questions/145699/let-posts-be-stored-in-another-table

    You may have to spend a few times to create the code and make it run smoothly. By creating the fields to import the content as the post data is easier and saves a lot of time.

    #18989
    Infolu OfficialInfolu Official
    Participant

    Perfect, I will study this, there is another reason that I look for something like this, when using the metabox custom table to store the postmetts at some point if I need to export the wp_post and import it on another site (that already has other posts) on time to import it assumes another id in wp_post and ends up losing the connection with the wp_custom_table that I created because in the custom table the reference is the post ID.

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