Skip to content

Instantly share code, notes, and snippets.

@greenhornet79
Created February 22, 2016 22:05
Show Gist options
  • Save greenhornet79/e1d4399a82dcc23e0900 to your computer and use it in GitHub Desktop.
Save greenhornet79/e1d4399a82dcc23e0900 to your computer and use it in GitHub Desktop.
<?php
public function create_blog_post() {
$blog_title = isset( $_POST['blog_title']) ? wp_strip_all_tags( $_POST['blog_title'] ) : '';
$blog_description = isset($_POST['blog_description']) ? strip_tags( $_POST['blog_description'] ) : '';
$tags = isset($_POST['blog_tags']) ? strip_tags( $_POST['blog_tags'] ) : '';
if ( !$blog_title || !$blog_description ) {
return;
}
$blog_post = array(
'post_title' => $blog_title,
'post_content' => $blog_description,
'post_status' => 'publish',
'tags_input' => $tags,
'post_author' => get_current_user_id()
);
$blog_id = wp_insert_post( $blog_post );
if ( $blog_id ) {
update_post_meta( $donation_id, 'amount', '5.00' );
// $video = new JS_Youtube_Maker_Youtube();
// $video->create_youtube_video( $blog_id );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment