Jump to content

Correct use of URL Hooks


markus_blue_tomato
 Share

Recommended Posts

I have tried to use following code in _init.php and _ready.php:

wire()->addHook('/hello-world', function($event) {
    return 'Hello World';
});

But got this back when I visit /hello-world:

Ouch… Error: Exception: Path hooks must be attached during init or ready states (in wire/core/WireHooks.php line 834)

When I add the hook in init.php I get the 404 Page.

Can anyone help me here?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...