@@ -284,6 +284,71 @@ public function test_no_duplicate_pings_on_deindexed_url() {
284284		$ this  ->assertSame ( home_url ( '/2025/updated-test-post-publish/ '  ), $ last_ping_url , 'Last ping URL should be the updated URL after the second ping. '  );
285285	}
286286
287+ 	/** 
288+ 	 * Ensure de-indexed URLs are pinged only once for private post type transitions. 
289+ 	 */ 
290+ 	public  function  test_no_duplicate_pings_on_private_post_type_transition () {
291+ 		$ post_id  = self ::$ post_ids ['publish ' ];
292+ 
293+ 		// Set the post to a private status. 
294+ 		wp_update_post (
295+ 			array (
296+ 				'ID '           => $ post_id ,
297+ 				'post_status '  => 'private ' ,
298+ 			)
299+ 		);
300+ 
301+ 		// Ensure the old URL is pinged. 
302+ 		$ this  ->assertPing ( home_url ( '/2025/test-post-publish/ '  ), 'Old post URL should be pinged after status change. '  );
303+ 
304+ 		// Clear the ping list. 
305+ 		$ this  ->pings  = array ();
306+ 
307+ 		// Set the post to a draft. 
308+ 		wp_update_post (
309+ 			array (
310+ 				'ID '           => $ post_id ,
311+ 				'post_status '  => 'draft ' ,
312+ 			)
313+ 		);
314+ 		// Ensure the old URL is not pinged again. 
315+ 		$ this  ->assertNotPing ( home_url ( '/2025/test-post-publish/ '  ), 'Old post URL should not be pinged again after second status change. '  );
316+ 	}
317+ 
318+ 	/** 
319+ 	 * Ensure previously deindexed URLs that now redirect are re-pinged. 
320+ 	 */ 
321+ 	public  function  test_republished_post_with_slug_change_pings_old_urls () {
322+ 		$ post_id  = self ::$ post_ids ['publish ' ];
323+ 
324+ 		// Set the post to draft. 
325+ 		wp_update_post (
326+ 			array (
327+ 				'ID '           => $ post_id ,
328+ 				'post_status '  => 'draft ' ,
329+ 			)
330+ 		);
331+ 
332+ 		// Ensure the old post URL is pinged. 
333+ 		$ this  ->assertPing ( home_url ( '/2025/test-post-publish/ '  ), 'Old post URL should be pinged after unpublishing. '  );
334+ 
335+ 		// Clear the ping list. 
336+ 		$ this  ->pings  = array ();
337+ 
338+ 		// Update the post slug and re-publish all in one update. 
339+ 		wp_update_post (
340+ 			array (
341+ 				'ID '           => $ post_id ,
342+ 				'post_name '    => 'final-test-post-publish ' ,
343+ 				'post_status '  => 'publish ' ,
344+ 			)
345+ 		);
346+ 
347+ 		// Ensure both URLs are pinged as the old URL is now a redirect. 
348+ 		$ this  ->assertPing ( home_url ( '/2025/test-post-publish/ '  ), 'Old post URL should be pinged after slug and status update to index the redirect. '  );
349+ 		$ this  ->assertPing ( home_url ( '/2025/final-test-post-publish/ '  ), 'New post URL should be pinged after slug and status update. '  );
350+ 	}
351+ 
287352	/** 
288353	 * Ensure updating the pinged URLs lists appends the new URLs correctly. 
289354	 */ 
0 commit comments