Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add actions and filters on front end #189

Open
tedsecretsource opened this issue Oct 20, 2017 · 1 comment
Open

How to add actions and filters on front end #189

tedsecretsource opened this issue Oct 20, 2017 · 1 comment
Labels

Comments

@tedsecretsource
Copy link

What is the recommended way to add actions and filters on the front end? Is there a "default" route that executes on every request or a way to say "every route except wp-admin"? I'd hate to think that we have to add lines to plugin.php. That seems like a hack, but I can't figure out where else to do that. Thanks in advance.

@tedmasterweb
Copy link

I found my own answer.

In herbert.config.php, under the requires section, include a file inside your app called actionsAndFilters.php. Then add your actions and filters there and voila, you are now loading actions and filters when your plugin runs. Very nice.

    /**
     * Auto-load all required files.
     */
    'requires' => [
        __DIR__ . '/app/customPostTypes.php',
        __DIR__ . '/app/actionsAndFilters.php'
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants