Changeset 3810121
- Timestamp:
- 11/18/2026 08:19:01 PM (less than one hour ago)
- Location:
- roomvu-marketing/trunk
- Files:
-
- 3 edited
-
lib/class-roomvu-marketing-post-manager.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
roomvu.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
roomvu-marketing/trunk/lib/class-roomvu-marketing-post-manager.php
r3773410 r3810121 230 230 * Return existing post ID when a post with the same title exists. 231 231 * 232 * Matches every form WordPress may already have stored. A site 233 * administrator on Multisite lacks unfiltered_html, so wp_insert_post() 234 * encodes "&" as "&" via title_save_pre. A user with unfiltered_html 235 * keeps the raw character. Searching only the raw title misses the 236 * encoded row and creates a duplicate on every import. 237 * 232 238 * @param string $title 233 239 * … … 236 242 protected function get_duplicate_post_id($title = '') 237 243 { 238 $query = new WP_Query([ 239 'post_type' => 'post', 240 'title' => $title, 241 'posts_per_page' => 1, 242 'post_status' => 'any', 243 'fields' => 'ids', 244 ]); 245 246 return !empty($query->posts) ? (int) $query->posts[0] : 0; 244 foreach ($this->post_title_lookup_values($title) as $lookup_title) { 245 $query = new WP_Query([ 246 'post_type' => 'post', 247 'title' => $lookup_title, 248 'posts_per_page' => 1, 249 'post_status' => 'any', 250 'fields' => 'ids', 251 ]); 252 253 if (!empty($query->posts)) { 254 return (int) $query->posts[0]; 255 } 256 } 257 258 return 0; 259 } 260 261 /** 262 * Title strings that can already exist for this import title. 263 * 264 * @param string $title Title after sanitize_text_field(). 265 * 266 * @return string[] 267 */ 268 protected function post_title_lookup_values($title) 269 { 270 $title = is_string($title) ? $title : ''; 271 if ($title === '') { 272 return array(); 273 } 274 275 $values = array( 276 $title, 277 wp_specialchars_decode($title, ENT_QUOTES), 278 wp_unslash(wp_filter_kses($title)), 279 ); 280 281 $stored = sanitize_post_field('post_title', $title, 0, 'db'); 282 if (is_string($stored)) { 283 $values[] = wp_unslash($stored); 284 } 285 286 $unique = array(); 287 foreach ($values as $value) { 288 if (!is_string($value) || $value === '') { 289 continue; 290 } 291 $unique[$value] = $value; 292 } 293 294 return array_values($unique); 247 295 } 248 296 -
roomvu-marketing/trunk/readme.txt
r3773410 r3810121 4 4 Requires at least: 4.9 5 5 Tested up to: 6.8 6 Stable tag: 1.7. 06 Stable tag: 1.7.1 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 29 29 30 30 == Changelog == 31 32 = 1.7.1 = 33 - Avoid duplicate posts when a title contains special characters such as "&". 31 34 32 35 = 1.7.0 = -
roomvu-marketing/trunk/roomvu.php
r3773410 r3810121 4 4 * Plugin Name: Roomvu Marketing 5 5 * Description: Roomvu Marketing Plugin allows you to integrate your WordPress with Roomvu, and automatically post your Roomvu videos to your WordPress website. 6 * Version: 1.7. 06 * Version: 1.7.1 7 7 * Author: Roomvu 8 8 * Author URI: https://roomvu.com
Note:
See TracChangeset
for help on using the changeset viewer.