I played around with the plugin files and was able to figure it out myself. For anyone who’s wondering, you can use wp_insert_post
. You just need to find what variable the generated shortcode is stored in, which can take a little digging through the plugin files. For the plugin I was working with, it went something like this:
$my_poll = array(
'post_content' => '[name_of_shortcode name_of_shortcode_attribute=" . $poll->_id . "]',
'post_status' => 'publish'
);
wp_insert_post($my_poll);