• Hi,

    We ran into a problem with KC interaction with our theme.
    In the theme, we built language translation functionality. It takes a page’s content, exports via the WP API, and then imports the translated files back (it creates a page for each target language using wp_insert_post).

    However, in recent KC versions after 2.6.17, KC started listening for wp_insert_post events, and to clear the filtered content (see code below). This means that the content we import back gets messed up.

    We’ve made a change ourselves in KC’s code to bypass this.

    Please check and let us know if it will be possible for you to implement into the next version of KC.

    kc.actions.php, line 643 :
    KC original code:

    if( !isset($_POST['action']) || $_POST['action'] !== 'inline-save'){
       $wpdb->update(
    
          $wpdb->prefix.'posts',
    
          array(
             'ID' => $id,
             'post_content_filtered' => ''
          ),
    
          array( 'ID' => $id )
       );
    }

    Our fix:

     ( !isset($_POST['action']) || $_POST['action'] !== 'inline-save' ) {
       if( $_POST['submit'] !== 'Import' ) {
          $wpdb->update(
             $wpdb->prefix.'posts',
             array(
                if 'ID' => $id,
                'post_content_filtered' => ''
             ),
    
             array( 'ID' => $id )
          );
       }
    }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Change for wp_insert_post’ is closed to new replies.