• Hi,

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

    But a link that is as follows:

    http://example.com/myendpoint/myvalue

    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?

    Regards,

    Paddelboot

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    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.

    Thread Starter paddelboot

    (@paddelboot)

    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.

    Paddelboot

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Register rewrite endpoint and having a static frontpage’ is closed to new replies.