url rewriting – Query vars to return the homepage


I would like to rewrite a path like example.com/foo to the “front” page (example.com).

So when I request example.com/foo the content shown should be that of example.com. Note, a redirect is NOT what I am looking for here.

I am trying to do this with the add_rewrite_rule() function but cant find the query vars to get the homepage

add_action( 'init', function() {

I also tried index.php?pagename=/, index.php?page=front, index.php (no query vars) and a bunch of other combinations.

I just cant seem to find the query var to tell WordPress to load the homepage.

yevg 1 year 2022-01-28T18:31:15-05:00 0 Answers 0 views 0

Leave an answer