Register rewrite endpoint and having a static frontpage (3 posts)

  1. paddelboot
    Posted 3 years ago #


    I am registering a rewrite endpoint which I need to use on a static front page.

    But a link that is as follows:


    will never display the page I have set as frontpage, but will always use index.php.

    Is this a bug, a feature or a misunderstanding?



  2. bcworkz
    Posted 3 years ago #

    A misunderstanding more than likely. Depending on how you added the endpoint, you probably end up with a request like example.com/index.php?myendpoint=myvalue. That's probably enough for index.php to not load your frontpage. index.php tries to decide which template to load based on the arguments, and without hooking some query args filter to manage the provided parameters, it probably fails miserably.

    If you use wp_add_rewrite_rule(), you can add a p parameter passing the ID of your front page to ensure it is loaded and receives the 'myvalue' taken from the initial url.

  3. paddelboot
    Posted 3 years ago #

    I added it using add_rewrite_endpoint(). According to the Codex, this function also creates the necessary query var(s). Also in other articles, I have not found a statement that endpoints are not supposed to work on static front pages. EP_ALL should include those, as far as I see it. Therefore, I consider it to be more of a bug at the moment.

    The solution with creating a custom rewrite rule just for the front page should work, nevertheless.


Topic Closed

This topic has been closed to new replies.

About this Topic