WordPress.org

Ready to get started?Download WordPress

Forums

Inserting the post from frontend wordpress (1 post)

  1. luitelbj
    Member
    Posted 1 year ago #

    I'm trying to insert the post from frontend along with custom meta field wordpress below is my code

    $post = array(
                'post_title' => wp_strip_all_tags( $title ),
                'post_content' => $description,
                'post_category' => $_POST['cat'],  // Usable for custom taxonomies too
                'tags_input' => $tags,
                'post_status' => 'publish',         // Choose: publish, preview, future, etc.
                'post_type' => $_POST['post-type']  // Use a custom post type if you want to
            );
    
            $insert=wp_insert_post($post);  // http://codex.wordpress.org/Function_Reference/wp_insert_post
    
            update_post_meta($insert, "player_info", "Hello I'm Bijay");

    well the problem is i created meta box on post, and i've to insert the post from frontend and i tried to insert the post via above code, but its not posting on that metabox, it making new custom-field and saving it there.

    Please help me, Thanks in advance :)

Topic Closed

This topic has been closed to new replies.

About this Topic