user_id; $post_content = $_POST['posttext']; $tags = $_POST['tags']; $char_limit = 40; $post_title = strip_tags( $post_content ); if( strlen( $post_title ) > $char_limit ) { $post_title = substr( $post_title, 0, $char_limit ) . ' ... '; } $post_id = wp_insert_post( array( 'post_author' => $user_id, 'post_title' => $post_title, 'post_content' => $post_content, 'tags_input' => $tags, 'post_status' => 'publish' ) ); wp_redirect( get_bloginfo( 'url' ) . '/' ); exit; } get_header( ); if( current_user_can( 'publish_posts' ) ) { require_once dirname( __FILE__ ) . '/post-form.php'; } ?>