Custom rewrite rules are sending everything to index.php

Finally figured it out. 1) I was calling the first function at ‘rewrite_rules_array’ instead of ‘init’ which was just dumb. 2) There was still something wrong with it, but I explored another area that seems obvious now, but which I originally glossed over because it seemed to be.

https://codex.wordpress.org/Rewrite_API/add_rewrite_endpoint
https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/

Just make an endpoint. WordPress already has the functionality built in to do what I was trying to do but it took me three days to search it out.

I literally replaced everything above (except .htaccess) with:

function manage_endpoint() {

    add_rewrite_endpoint( 'manage', EP_PERMALINK );

}
add_filter('init', 'manage_endpoint');

Leave a Comment