• Resolved mikeymoose93

    (@mikeymoose93)


    First off, great plugin!

    I have a client who is pretty technology-illiterate, so I’m trying to devise a custom form for them to use that keeps them completely out of the wp dashboard.

    I’m using wp_insert_post and passing it this array:

    $new_post = array(
        'post_title'    =>   $title,
        'tax_input'     =>   array(                     // Usable for custom taxonomies too
            'sdm_categories' => array(
                $_POST['category'],
            ),
            'sdm_description' => $_POST['description'],
            'sdm_upload' => $url
        ),
        'post_status'   =>   'publish',                 // Choose: publish, preview, future, draft, etc.
        'post_type'     =>   'sdm_downloads'            //'post',page' or use a custom post type if you want to
        );

    I can successfully add a new sdm post with a title and category. I’m getting tripped up on the file URL and post content. The usual wp ‘post_content’ param isn’t working for me. I looked at the <input> tags in the editor, which is where I got ‘sdm_upload’ from. I’ve spent a few hours trying to fill these values and I’m stuck. Any help is appreciated! I haven’t given it a shot, but a parameter where I can select a file thumbnail image would be nice too.

    https://wordpress.org/plugins/simple-download-monitor/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_insert_post array’ is closed to new replies.