I am trying to make a form that auto posts without needing to be signed in. So far I'm testing with dummy data, but I'm running into trouble with the add_post_meta part. It seems to only be adding 1 character (the 2nd one for some reason). This is my code:
<?php $my_post = array( 'post_title' => wp_strip_all_tags('testing'), 'post_author' => 5, 'post_content' => 'This is my post.', 'post_category' => array( 135 ), 'post_status' => 'draft', 'post_type' => 'portal', ); $post_id = wp_insert_post($my_post); add_post_meta($post_id, 'portal_tl_name', 'karen'); add_post_meta($post_id, 'portal_tl_brokerage', 'coquitlam'); ?>
When I load the page with this script, it add's the post, but in the 2 sections with meta data, I'm only seeing:
I'm not sure why. Am I missing something?