Problems with creating post programmatically for guest.
-
I have a classified ads type site where guests can create posts (custom post type).
Creating the new post works fine for logged in users.
When guests try to create a post the slug does not get set. The post itself still gets created but the slug, category, and tags are all left out.
$post = array( 'post_title' => $_POST['title'], 'post_name' => $slug, 'post_author' => 1, 'post_content' => $_POST['content'], 'post_type' => 'classifieds', 'post_status' => 'pending', 'tags_input' => $tags, 'tax_input' => array('cat' => $term_id) );
Does a user have to be logged in to create a post? Is there something I’m missing?
Thanks.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Problems with creating post programmatically for guest.’ is closed to new replies.