Plugin Directory

Changeset 3492289


Ignore:
Timestamp:
03/27/2026 03:40:00 AM (6 days ago)
Author:
aiktp
Message:

Deploy version 5.0.6 to trunk

Location:
aiktp/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • aiktp/trunk/aiktp.php

    r3445251 r3492289  
    44 * Plugin URI: https://aiktp.com/wordpress
    55 * Description: AIKTP - AI powered WordPress content automation. Create SEO optimized articles, bulk generate WooCommerce product descriptions, and sync posts directly from aiktp.com.
    6  * Version: 5.0.5
     6 * Version: 5.0.6
    77 * Author: John Luke - aiktp.com
    88 * License: GPL v2 or later
     
    2222
    2323// Define constants
    24 define('AIKTPZ_VERSION', '5.0.5');
     24define('AIKTPZ_VERSION', '5.0.6');
    2525define('AIKTPZ_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2626define('AIKTPZ_PLUGIN_URL', plugin_dir_url(__FILE__));
  • aiktp/trunk/includes/aiktp-sync.php

    r3445248 r3492289  
    606606        $cat_id = $request['catId'] ? $request['catId'] : '0';
    607607        $post_status = $request['post_status'] ? $request['post_status'] : 'publish';
     608        $current_post_id = !empty($request['currentPostId']) ? absint($request['currentPostId']) : 0;
    608609       
    609610        // Get author
     
    664665        $final_categories = $is_woo_product ? $product_categories : $regular_categories;
    665666       
     667        $post_date = current_time('mysql');
     668        $post_date_gmt = current_time('mysql', 1);
     669        if (!empty($request['postTime'])) {
     670            $post_time = strtotime($request['postTime']);
     671            if ($post_time) {
     672                $post_date = date('Y-m-d H:i:s', $post_time);
     673                $post_date_gmt = gmdate('Y-m-d H:i:s', $post_time);
     674            }
     675        }
     676
    666677        // Build post data
    667678        $new_post = array(
     
    672683            'post_author' => $aiktp_author,
    673684            'post_type' => $post_type,
    674             'post_date' => current_time('mysql'),
    675             'post_date_gmt' => current_time('mysql', 1)
     685            'post_date' => $post_date,
     686            'post_date_gmt' => $post_date_gmt
    676687        );
    677688       
     
    682693       
    683694        kses_remove_filters();
    684         $post_id = wp_insert_post($new_post);
     695        if (empty($current_post_id)) {
     696            $post_id = wp_insert_post($new_post);
     697        } else {
     698            $new_post['ID'] = $current_post_id;
     699
     700            try {
     701                unset($new_post['post_date']);
     702                unset($new_post['post_date_gmt']);
     703                $new_post['post_modified'] = $post_date;
     704                $new_post['post_modified_gmt'] = $post_date_gmt;
     705                $post_id = wp_update_post($new_post);
     706
     707                if (empty($post_id)) {
     708                    unset($new_post['ID']);
     709                    $new_post['post_date'] = $post_date;
     710                    $new_post['post_date_gmt'] = $post_date_gmt;
     711                    $post_id = wp_insert_post($new_post);
     712                }
     713            } catch (Exception $e) {
     714                unset($new_post['ID']);
     715                $new_post['post_date'] = $post_date;
     716                $new_post['post_date_gmt'] = $post_date_gmt;
     717                $post_id = wp_insert_post($new_post);
     718            }
     719        }
    685720        kses_init_filters();
    686721       
  • aiktp/trunk/readme.txt

    r3445251 r3492289  
    55Tested up to: 6.9
    66Requires PHP: 7.0
    7 Stable tag: 5.0.5
     7Stable tag: 5.0.6
    88License: GPL v2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.