Even though hooks in WordPress are amazing and everyone uses them knowingly or unknowingly, I get the impression that some advanced users and especially front-end developers still seem to avoid them. If you feel like you’ve been holding back on hooks, too, then this article will get you started. I am also going to reveal some interesting details to anyone who thinks they are familiar enough with hooks. You’ll want to read this article especially if you’d like to:
understand code snippets with hooks such as those found in forums;
extend WordPress, plugins and themes without breaking updates;
learn how to avoid common problems;
allow others to extend your code.
My examples are taken from WordPress’ core and from my work as a freelance developer and author of the Advanced Ads plugin.
Whenever you want to do something or customize something in WordPress, then there is very likely a hook you can use.
The “do” hook is called an “action.” Wherever an action is defined, you can execute your own code. Here are some examples:
send an email to the author once a post is published;
load a custom script file in the footer of the page;
add instructions above the login form.
The most important thing #wordpress #smallbusiness #entrepreneur
https://managewp.org/articles/11479/useful-tips-to-get-started-with-wordpress-hooks-smashing-magazine
No comments:
Post a Comment