Changeset 3135951
- Timestamp:
- 08/15/2024 06:10:08 AM (20 months ago)
- Location:
- ai-translate-for-polylang
- Files:
-
- 8 added
- 2 edited
-
tags/1.0.8 (added)
-
tags/1.0.8/ai-translate-polylang.php (added)
-
tags/1.0.8/inc (added)
-
tags/1.0.8/inc/open-ai (added)
-
tags/1.0.8/inc/open-ai/OpenAi.php (added)
-
tags/1.0.8/inc/open-ai/Url.php (added)
-
tags/1.0.8/inc/settingslib.php (added)
-
tags/1.0.8/readme.txt (added)
-
trunk/ai-translate-polylang.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ai-translate-for-polylang/trunk/ai-translate-polylang.php
r3135327 r3135951 4 4 Plugin URI: https://wordpress.org/plugins/ai-translate-polylang/ 5 5 Description: Add auto AI translation caperbility to Polylang 6 Version: 1.0. 76 Version: 1.0.8 7 7 Author: James Low 8 8 Author URI: http://jameslow.com … … 177 177 } 178 178 } 179 public static $author = 0; 180 public static function wp_insert_post_data($data , $postarr) { 181 $data['post_author'] = self::$author; 182 self::$author = 0; 183 remove_filter('wp_insert_post_data', array(static::class, 'wp_insert_post_data'), 99); 184 return $data; 185 } 179 186 public static function translate_post($post_id, $to, $status = 'publish') { 180 187 $from = pll_get_post_language($post_id); … … 182 189 if (!$translation || get_post_status($translation) !== false) { 183 190 $post = get_post($post_id); 184 191 192 self::$author = $post->post_author; 193 add_filter('wp_insert_post_data', array(static::class, 'wp_insert_post_data'), '99', 2); 185 194 // Create a new post with the same content 186 195 $new_post_id = wp_insert_post([ … … 190 199 'post_status' => $status, 191 200 'post_type' => $post->post_type, 192 'post_author' => $post->post_author, 201 'post_author' => $post->post_author, //Wordpress overrides author to 0, hence hook 193 202 'post_date' => $post->post_date, 194 203 'post_date_gmt' => $post->post_date_gmt, -
ai-translate-for-polylang/trunk/readme.txt
r3135327 r3135951 5 5 Requires at least: 3.0 6 6 Tested up to: 6.6.1 7 Stable tag: 1.0. 77 Stable tag: 1.0.8 8 8 License: MIT 9 9 License URI: https://opensource.org/licenses/MIT … … 34 34 == Changelog == 35 35 36 = 1.0.8 = 37 * Correctly set author in translated post 38 36 39 = 1.0.7 = 37 * Copy author and dates when translati onpost40 * Copy author and dates when translating post 38 41 39 42 = 1.0.6 =
Note: See TracChangeset
for help on using the changeset viewer.