File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -197,4 +197,49 @@ public function test_ping_on_draft_publish() {
197197
198198 $ this ->assertPing ( home_url ( '/2025/test-post-draft/ ' ), 'Ping should include the post URL on draft publish. ' );
199199 }
200+
201+ /**
202+ * Ensure a private CPT does not ping.
203+ */
204+ public function test_no_ping_on_private_cpt () {
205+ register_post_type (
206+ 'private_cpt ' ,
207+ array (
208+ 'public ' => false ,
209+ 'supports ' => array ( 'title ' , 'editor ' ),
210+ )
211+ );
212+ $ post_id = $ this ->factory ->post ->create (
213+ array (
214+ 'post_type ' => 'private_cpt ' ,
215+ 'post_status ' => 'publish ' ,
216+ )
217+ );
218+
219+ unregister_post_type ( 'private_cpt ' );
220+ $ this ->assertNotPing ( get_permalink ( $ post_id ), 'Private CPT should not ping. ' );
221+ }
222+
223+ /**
224+ * Ensure a custom private post status does not ping.
225+ */
226+ public function test_no_ping_on_custom_private_post_status () {
227+ global $ wp_post_statuses ;
228+ register_post_status (
229+ 'custom_private ' ,
230+ array (
231+ 'public ' => false ,
232+ )
233+ );
234+ $ post_id = $ this ->factory ->post ->create (
235+ array (
236+ 'post_type ' => 'post ' ,
237+ 'post_status ' => 'custom_private ' ,
238+ )
239+ );
240+
241+ // unregister_post_status doesn't exist.
242+ unset( $ wp_post_statuses ['custom_private ' ] );
243+ $ this ->assertNotPing ( get_permalink ( $ post_id ), 'Custom private post status should not ping. ' );
244+ }
200245}
You can’t perform that action at this time.
0 commit comments