• Resolved niel

    (@nielfernandez)


    Hello, Expert, I need help!
    I have a custom multiple input fields aside of content, and title, for instance, Imagine ACF WordPress plugins it can generate multiple input fields and create post at the same time? WHERE that value goes in? and how to do that insert post to the POST table without ACF plugins?

    The primary concern is when I query the post that I posted from my custom multiple fields made by HTML it will return to me according to my parameters the same as the default query.

    ex.
    array (
    ‘post-type’ => ‘My post’,
    ‘category’ => ‘myCat’
    )

    The point is when I do that query assume that custom field that I made from HTML will be executed or fetch at the same time, Is that possible with WordPress default table. or I have to create separated table and query by occasion.

Viewing 3 replies - 1 through 3 (of 3 total)
  • There is a posts table and a separate post_meta table. (same for comments, users, taxonomies)
    Take a look here: https://codex.www.ads-software.com/Database_Description
    Also, here are the functions: https://developer.www.ads-software.com/?s=post_meta

    • This reply was modified 4 years, 4 months ago by Joy. Reason: post_meta functions
    Moderator bcworkz

    (@bcworkz)

    You can insert posts via PHP with wp_insert_post() but as Joy points out this isn’t meant specifically for meta data. It will add meta data through the added “meta_input” parameter but if you’re adding your own meta boxes like ACF does to the post edit screen you would not be using this function. For more on meta data and meta boxes in the post edit screen see https://developer.www.ads-software.com/plugins/metadata/

    You can compose your own query that qualifies results by meta values, but it’s usually desirable to modify the default main query through the “pre_get_posts” action.
    https://developer.www.ads-software.com/reference/hooks/pre_get_posts/

    You’ll have less trouble with pagination of the results by modifying the main query because nearly all template pagination functions assume they are working on the main query. Using your own query will cause these functions to fail to work as expected.

    It is possible to store data in a custom table and make queries which involve this data, but doing so is usually not warranted. Most meta data needs are best handled using the built in functionality provided by WP.

    Thread Starter niel

    (@nielfernandez)

    Thank you very much, @bcworkz , @joyously, This information will very helpful to me the links and description guide made my research easy.

    Have a great day! Stay home keep safe.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to insert post to wp_post table with custom html field form’ is closed to new replies.