Make WordPress Core


Ignore:
Timestamp:
09/15/2015 06:53:12 PM (9 years ago)
Author:
wonderboymusic
Message:

In WP::parse_request(), don't add query vars of non-viewable post types to WP::public_query_vars. In register_post_type(), don't add query vars of non-viewable post types to WP::public_query_vars.
In _unregister_post_type() (unit tests), don't add query vars of non-viewable post types to WP::public_query_vars.

Adds unit test.

Fixes #30018.

File:
1 edited

Legend:

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

    r32918 r34215  
    145145    }
    146146
     147    /**
     148     * @ticket 30018
     149     */
     150    function test_parse_request_home_path_non_public_type() {
     151        register_post_type( 'foo', array( 'public' => false ) );
     152
     153        $url = add_query_arg( 'foo', '1', home_url() );
     154
     155        $this->go_to( $url );
     156
     157        _unregister_post_type( 'foo' );
     158
     159        $this->assertEquals( array(), $GLOBALS['wp']->query_vars );
     160    }
     161
    147162    function test_url_to_postid_dupe_path() {
    148163        update_option( 'home', home_url('/example/') );
Note: See TracChangeset for help on using the changeset viewer.