You appear to be a bot. Output may be restricted
Description
Insert a post of the specified post type with custom fields set from the validated fields
Usage
$ID = bw_insert_post( $post_type, $validated );
Parameters
- $post_type
- ( string ) required –
- $validated
- ( array ) required – containing both post fields and post meta data fields
Returns
ID post ID of the created post
TO DO
We may want to add our own additions to the post_content. e.g. for "dtib_review" we want to add <!–more –>[bw_fields] What's the best way of doing this?
TO DO
This assumes that we will have set the post_title, post_content and post_status in $validated. What do we do if we haven't?
Source
File name: oik-fields/shortcodes/oik-new.php
Lines:
1 to 14 of 14
function bw_insert_post( $post_type, $validated ) { $post = array( 'post_type' => $post_type , 'post_title' => $validated['post_title'] , 'post_name' => $validated['post_title'] , 'post_content' => $validated['post_content'] ); $post = bw_set_validated_field( $post, $validated, 'post_status' ); $post = bw_set_validated_field( $post, $validated, "post_date" ); /* Set metadata fields */ $_POST = $validated; $post_id = wp_insert_post( $post, TRUE ); bw_trace2( $post_id, "post_id", true, BW_TRACE_DEBUG ); return( $post_id ); }