Title: Multi site/Insert shortcodes programmatically
Last modified: April 29, 2020

---

# Multi site/Insert shortcodes programmatically

 *  Resolved [Antal Tettinger](https://wordpress.org/support/users/antaltettinger/)
 * (@antaltettinger)
 * [6 years ago](https://wordpress.org/support/topic/multi-site-insert-shortcodes-programmatically/)
 * Dear Vaakash,
 * We have a multi site and there are some shortcodes which has to be changed one-
   by-one for each site if we would like to update it which is very cumbersome.
 * If you could help me with an idea how could I update a shortcode from PHP I could
   write some script to loop through all the sites, get a shortcode from the main
   one and then update it for the other sites.
 * Could you help me to point me to which function is responsible to update a shortcode?
   Or do you have some other suggestions please?

Viewing 1 replies (of 1 total)

 *  Plugin Author [vaakash](https://wordpress.org/support/users/vaakash/)
 * (@vaakash)
 * [6 years ago](https://wordpress.org/support/topic/multi-site-insert-shortcodes-programmatically/#post-12751334)
 * Hi Antal,
 * Shortcoder uses WordPress’s custom post type feature.
 * So you can use WordPress’s API to get the post, edit and save it.
 * To get the shortcodes, use `get_posts` with post type set to “shortcoder”
    [https://developer.wordpress.org/reference/functions/get_posts/](https://developer.wordpress.org/reference/functions/get_posts/)
 * To update the post, you can use `wp_update_post`
    [https://developer.wordpress.org/reference/functions/wp_update_post/](https://developer.wordpress.org/reference/functions/wp_update_post/)
 * Hope it helps.
 * Thanks,
    Aakash

Viewing 1 replies (of 1 total)

The topic ‘Multi site/Insert shortcodes programmatically’ is closed to new replies.

 * ![](https://ps.w.org/shortcoder/assets/icon.svg?rev=2222236)
 * [Shortcoder — Create Shortcodes for Anything](https://wordpress.org/plugins/shortcoder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcoder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcoder/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcoder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcoder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcoder/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [vaakash](https://wordpress.org/support/users/vaakash/)
 * Last activity: [6 years ago](https://wordpress.org/support/topic/multi-site-insert-shortcodes-programmatically/#post-12751334)
 * Status: resolved