Make WordPress Core


Ignore:
Timestamp:
10/18/2020 11:21:03 PM (4 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical.php

    r48937 r49200  
    277277
    278278    /**
     279     * Ensure multiple post types do not throw a notice.
     280     *
     281     * @ticket 43056
     282     */
     283    public function test_redirect_guess_404_permalink_post_types() {
     284        /*
     285         * Sample-page is intentionally missspelt as sample-pag to ensure
     286         * the 404 post permalink guessing runs.
     287         *
     288         * Please do not correct the apparent typo.
     289         */
     290
     291        // String format post type.
     292        $this->assertCanonical( '/?name=sample-pag&post_type=page', '/sample-page/' );
     293        // Array formatted post type or types.
     294        $this->assertCanonical( '/?name=sample-pag&post_type[]=page', '/sample-page/' );
     295        $this->assertCanonical( '/?name=sample-pag&post_type[]=page&post_type[]=post', '/sample-page/' );
     296    }
     297
     298    /**
    279299     * @ticket 43745
    280300     */
Note: See TracChangeset for help on using the changeset viewer.