Title: Insert function
Last modified: September 17, 2017

---

# Insert function

 *  Resolved [mammut3d](https://wordpress.org/support/users/mammut3d/)
 * (@mammut3d)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/)
 * Hi,
    First, thank you for you awesome plugin. I am using wordpress functions 
   to automatically insert post in wordpress blog. I want to show the post in telegram
   channel after post insertion. Is there any function to insert post according 
   admin settings just after my insertion? a function that gets post_id and send
   post to telegram channel after including your Wptelegram class?
    -  This topic was modified 8 years, 8 months ago by [mammut3d](https://wordpress.org/support/users/mammut3d/).

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

 *  [Manzoor Wani](https://wordpress.org/support/users/manzoorwanijk/)
 * (@manzoorwanijk)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9504475)
 * Hello,
    If you use `wp_insert_post` function of WordPress, then the plugin will
   be triggered to handle the post data to be sent to Telegram. But, for this to
   work, you will have to uncheck **“Show ON/OFF switch on the post edit screen”**
   in WordPress Settings section of the plugin and then Save the Settings.
 *  Thread Starter [mammut3d](https://wordpress.org/support/users/mammut3d/)
 * (@mammut3d)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9504974)
 * Yes, it works now. But there is a problem, i set the feature image after post
   insertion. Can you please give me another solution. I want to have feature image
   in telegram post. Or can you please tell me how to trig your plugin after set
   feature image. I have post id in that section.
    Thank you
 *  [Manzoor Wani](https://wordpress.org/support/users/manzoorwanijk/)
 * (@manzoorwanijk)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9505101)
 * You can manually trigger the process by calling `handle_save_post` method of `
   Wptelegram_Post_Handler` class, by passing `$post_id` and `$post` as first and
   second argument respectively.
    But to only send featured image and to avoid the
   text being again, you can add this filter to make the message template empty.`
   add_filter( 'wptelegram_message_template', '__return_false' );`
 * Another simple solution is to enable the option to send existing posts as well
   and use the above filter along with it when updating the post.
 *  Thread Starter [mammut3d](https://wordpress.org/support/users/mammut3d/)
 * (@mammut3d)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9505184)
 * Thank you again.
    I think the first solution is nice, i searched about $post 
   and because of my weakness in programing i did not understand concept of it. 
   I have `$post_id` in program and how i can have `$post`? After that, Is this 
   way correct?
 *     ```
       require_once('../wp-content/plugins/wptelegram/wptelegram.php');
       handle_save_post( $post_id, $post );
       ```
   
    -  This reply was modified 8 years, 8 months ago by [mammut3d](https://wordpress.org/support/users/mammut3d/).
    -  This reply was modified 8 years, 8 months ago by [mammut3d](https://wordpress.org/support/users/mammut3d/).
 *  [Manzoor Wani](https://wordpress.org/support/users/manzoorwanijk/)
 * (@manzoorwanijk)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9505201)
 * If your code is executed by WordPress then you don’t need to include the plugin
   file. You can directly initialize the class.
 * You can use `get_post` function to set `$post` variable. Like
    `$post = get_post(
   $post_id );`
 *  Thread Starter [mammut3d](https://wordpress.org/support/users/mammut3d/)
 * (@mammut3d)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9505291)
 * Thank you for every thing. The problem is solved. I gave you 5 stars.
    -  This reply was modified 8 years, 8 months ago by [mammut3d](https://wordpress.org/support/users/mammut3d/).

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

The topic ‘Insert function’ is closed to new replies.

 * ![](https://ps.w.org/wptelegram/assets/icon-256x256.png?rev=2500018)
 * [WP Telegram (Auto Post and Notifications)](https://wordpress.org/plugins/wptelegram/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wptelegram/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wptelegram/)
 * [Active Topics](https://wordpress.org/support/plugin/wptelegram/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wptelegram/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wptelegram/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [mammut3d](https://wordpress.org/support/users/mammut3d/)
 * Last activity: [8 years, 8 months ago](https://wordpress.org/support/topic/insert-function/#post-9505291)
 * Status: resolved