[wp-trac] [WordPress Trac] #44773: Non Existing Child Page Redirects Instead of 404
WordPress Trac
noreply at wordpress.org
Fri Aug 10 19:33:17 UTC 2018
#44773: Non Existing Child Page Redirects Instead of 404
---------------------------+-----------------------------
Reporter: Asitha | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 4.9.8
Severity: critical | Keywords: needs-patch
Focuses: |
---------------------------+-----------------------------
Steps to reproduce:
1. Register Custom Post Type with hierarchical set to true (We'll call it
events)
2. Create the following structure in the CPT:
* Test
* Test 2
* Child (Child of Test 2)
3. Go to https://localhost/events/test/child and this will redirect you to
https://localhost/events/test-2/child instead of returning a 404.
Extra Step:
If you create a normal page of "Test" and try to navigate to
https://localhost/test/child, it will redirect to
https://localhost/test-2/child.
All this was done on vanilla WordPress on Twenty Seventeen theme.
{{{
function register_my_cpts_events() {
/**
* Post Type: Events.
*/
$labels = array(
"name" => __( "Events", "" ),
"singular_name" => __( "Event", "" ),
);
$args = array(
"label" => __( "Events", "" ),
"labels" => $labels,
"description" => "Event overview and resource pages",
"public" => true,
"hierarchical" => true,
"menu_icon" => "dashicons-calendar-alt",
"supports" => array( "title", "editor", "thumbnail",
"excerpt", "revisions", "page-attributes" ),
);
register_post_type( "events", $args );
}
add_action( 'init', 'register_my_cpts_events' );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44773>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list