Title: Automatic sync for posts
Last modified: January 28, 2020

---

# Automatic sync for posts

 *  [slotstartslotend](https://wordpress.org/support/users/slotstartslotend/)
 * (@slotstartslotend)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/automatic-sync-for-posts/)
 * I’m working on a multilingual wordpress website using the Polylang plug-in on
   pages and custom post types.
 * What I’m looking for is a way to have every post synch automatically, without
   user input. When creating a new post type, a translation would be automatically
   created and all contents copied
 * After some research I figured the method above is used when duplicating/synchronizing
   posts in bulk:
 *     ```
       $polylang = PLL();
       $sync_model = new PLL_Sync_Post_Model( $polylang );
       $sync_model->copy_post( $post_id, $lang, $sync );
   
       $post_id is the source post id.
       $lang is the target language.
       $sync is false to simply duplicate the post, true to activate the synhronization.
       ```
   
 * I tried to attach it to to the ‘save_post’ like this:
 *     ```
       function polylang_sync($post_id) {
           $polylang = PLL();
           $sync_model = new PLL_Sync_Post_Model( $polylang );
           $sync_model->copy_post( $post_id, $lang, $sync );
       }
       add_action( 'save_post', 'polylang_sync' );
       ```
   
 * And I get the following error message:
    `Warning: call_user_func_array() expects
   parameter 1 to be a valid callback, function 'polylang_sync' not found or invalid
   function name in (...)wp/wp-includes/class-wp-hook.php on line 290`
 * I’m not sure what I’m doing wrong, or what I could change about this to make 
   it work. I tried variations of this to no avail, I may be taking the wrong approach
   here.
 * Thanks in advance

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

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/automatic-sync-for-posts/#post-12374411)
 * Hello,
 * You are using Polylang Pro and it is not allowed to support Premium plugins on
   this forum. Please contact the Polylang Pro helpdesk at [https://polylang.pro/support/](https://polylang.pro/support/)
 *  Thread Starter [slotstartslotend](https://wordpress.org/support/users/slotstartslotend/)
 * (@slotstartslotend)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/automatic-sync-for-posts/#post-12376248)
 * Hi [@chouby](https://wordpress.org/support/users/chouby/), I didn’t mean to go
   against the rules, however, I have contacted support and I was told I couldn’t
   be helped further and had to seek help somewhere else. This is me trying to get
   help somewhere else.

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

The topic ‘Automatic sync for posts’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

## Tags

 * [automatic](https://wordpress.org/support/topic-tag/automatic/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 2 replies
 * 2 participants
 * Last reply from: [slotstartslotend](https://wordpress.org/support/users/slotstartslotend/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/automatic-sync-for-posts/#post-12376248)
 * Status: not resolved