mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Canonical: Support multiple post types in redirect_guess_404_permalink().
Prevent `redirect_guess_404_permalink()` from throwing a notice when multiple post types are included in the `post_type` query. Props junaidbhura. Fixes #43056. git-svn-id: https://develop.svn.wordpress.org/trunk@49200 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -275,6 +275,26 @@ class Tests_Canonical extends WP_Canonical_UnitTestCase {
|
||||
$this->assertFalse( redirect_guess_404_permalink() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure multiple post types do not throw a notice.
|
||||
*
|
||||
* @ticket 43056
|
||||
*/
|
||||
public function test_redirect_guess_404_permalink_post_types() {
|
||||
/*
|
||||
* Sample-page is intentionally missspelt as sample-pag to ensure
|
||||
* the 404 post permalink guessing runs.
|
||||
*
|
||||
* Please do not correct the apparent typo.
|
||||
*/
|
||||
|
||||
// String format post type.
|
||||
$this->assertCanonical( '/?name=sample-pag&post_type=page', '/sample-page/' );
|
||||
// Array formatted post type or types.
|
||||
$this->assertCanonical( '/?name=sample-pag&post_type[]=page', '/sample-page/' );
|
||||
$this->assertCanonical( '/?name=sample-pag&post_type[]=page&post_type[]=post', '/sample-page/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 43745
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user