Viewing 1 replies (of 1 total)
  • Thread Starter laurahreniucu

    (@laurahreniucu)

    I found the “save” function in query-builder.php . But I couldn’t find any way to get the info inserted in the new docs form into the database.

    I found:

    $defaults = array(
    				'post_type'    => $this->post_type_name,
    				'post_title'   => $_POST['doc']['title'],
    				'post_name'    => isset( $_POST['doc']['permalink'] ) ? sanitize_title( $_POST['doc']['permalink'] ) : sanitize_title( $_POST['doc']['title'] ),
    				'post_content' => sanitize_post_field( 'post_content', $doc_content, 0, 'db' ),
    				'post_status'  => 'publish'
    			);

    But when i edit this “defaults” to add more fields it doesn’t do anything. My try:

    $defaults = array(
    				'post_type'    => $this->post_type_name,
    				'post_title'   => $_POST['doc']['title'],
    				'nr_data_contract' => $_POST['nr_data_contract'],
    				'nr_data_fisa' => $_POST['nr_data_fisa'],
    				'post_name'    => isset( $_POST['doc']['permalink'] ) ? sanitize_title( $_POST['doc']['permalink'] ) : sanitize_title( $_POST['doc']['title'] ),
    				'post_content' => sanitize_post_field( 'post_content', $doc_content, 0, 'db' ),
    				'post_status'  => 'publish'
    			);

    “nr_data_contract” and “nr_data_fisa” are the ids of the new fields in the docs creation page.
    Is there something else i have to do to get the data in the database?

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘save new fields in database’ is closed to new replies.