Title: create automatically a post with shortcode from custom post?
Last modified: February 3, 2021

---

# create automatically a post with shortcode from custom post?

 *  [mickna](https://wordpress.org/support/users/mickna/)
 * (@mickna)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/)
 * Hi there,
 * I ask myself:
    Is it possible to generate a post, that includes a shortcode which
   is generated from a custom post? If this sounds like a cat chasing her tail:
 * 1) I use a plugin, which generates polls. This polls are a custom post type
    
   2) After creating that poll, I have to insert a shortcut in a regularly post 
   or page to see the poll in frontend.
 * I want to bypass step 2. If I save my poll (custom post) I would like to create
   a post with the depending shortcut automatically.
    Is there a hook(?) I can use?
 * I hope this makes sens and anyone can point me in a direction.
 * Best,
    mickna

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/#post-13997181)
 * Hi,
 * What you could do is use the function `do_shortcode()`
 * [https://developer.wordpress.org/reference/functions/do_shortcode/](https://developer.wordpress.org/reference/functions/do_shortcode/)
 * in a custom template.
 * There may also be hooks or function in the plugin that generates the poll, but
   you would be best to ask the plugin developer directly ( especially as we have
   no idea what plugin you are using )
 * Alan
 *  Thread Starter [mickna](https://wordpress.org/support/users/mickna/)
 * (@mickna)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/#post-13997350)
 * Hi [@fullworks](https://wordpress.org/support/users/fullworks/)
 * Thank you.
    But I need to call this (or a similar) function, if a user saves (
   publish) his custom post. That’s the point, where I thought I could use a hook
   to capture the publishing procedure and call `do_shortcode()`
 * mickna
 *  [fullworks](https://wordpress.org/support/users/fullworks/)
 * (@fullworks)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/#post-13997426)
 * yes hook to
    `save_post_{$post_type}`
 * [https://developer.wordpress.org/reference/hooks/save_post_post-post_type/](https://developer.wordpress.org/reference/hooks/save_post_post-post_type/)
 *  Thread Starter [mickna](https://wordpress.org/support/users/mickna/)
 * (@mickna)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/#post-13997440)
 * Great!
    Thank you [@fullworks](https://wordpress.org/support/users/fullworks/).
 * Helped me a lot 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘create automatically a post with shortcode from custom post?’ is closed
to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 2 participants
 * Last reply from: [mickna](https://wordpress.org/support/users/mickna/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/create-automatically-a-post-with-shortcode-from-custom-post/#post-13997440)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
