I would like to create a custom rewrite rule that will take the URL:
http://domain/submit-project/add
but display
http://domain/wp/wp-admin/post-new.php?post_type=project
Is there any way to do this? I am trying to add the rewrite rule so in my theme's functions.php
add_action( 'init', 'add_custom_rules' );
function add_custom_rules() {
add_rewrite_rule(
"^submit-project/add",
"/wp/wp-admin/post-new.php?post_type=project",
"top");
}
I've tried flushing the rules, but this always seems to enter some kind of loop always going back to the 'login' page.
Edit
- The URL is actually just 404-ing now
- I should add that I do have a page with the slug
submit-project
and thus the URL:http://domain.com/submit-project
in case it matters. - I've installed the plugin Rewrite Rules Inspector and can't seem to find my rule in there.
index.php
get written to .htaccess instead of being added to the rule array. I'm not entirely sure it would work anyway, since there would probably be issues with the admin cookies working outside of the admin directory and (if using any kind of domain mapping) cross-domain cookie issues as well.