WordPress Education, WordPress for Education

Hooks API from scratch – Part 3: An experiential guide to action hooks

Let’s perform an exercise

Read the following paragraph:

Some people wonder why WordPress wants the ‘p’ in WordPress to be capitalised. It is a little inconvenient to capitalise the ‘p’ in the middle of the word. Many agree that WordPress could easily be written as WordPress or wordpress or wordPress without any difference. Still, the WordPress team uses it this way. In fact, there is a function called, capital_P_dangit that takes any other casing and converts it into WordPress. This way, you don’t have to worry about writing WordPress the right way!

Now, read it again, but this time, read it aloud. After every word, if the word is ‘WordPress’ (in any case), loudly say this:

I’ll make it easier for you by highlighting it:

Some people wonder why WordPress wants the ‘p’ in WordPress to be capitalised. It is a little inconvenient to capitalise the ‘p’ in the middle of the word. Many agree that WordPress could easily be written as WordPress or wordpress or wordPress without any difference. Still, the WordPress team uses it this way. In fact, there is a function called, capital_P_dangit that takes any other casing and converts it into WordPress. This way, you don’t have to worry about writing WordPress the right way!

You just learnt what WordPress action hooks are and how they work, congrats!

Wait, what?

I know this may not be very obvious. Don’t worry, I’ll explain this in the next post. However, here’s a little clue:

Some people wonder why WordPress do_action( 'say_kakapo', 'WordPress'); wants the ‘p’ in WordPress do_action( 'say_kakapo', 'WordPress'); to be capitalised. It is a little inconvenient to capitalise the ‘p’ in the middle of the word. Many agree that WordPress do_action( 'say_kakapo', 'WordPress'); could easily be written as WordPress do_action( 'say_kakapo', 'WordPress'); or wordpress do_action( 'say_kakapo', 'Wordpress'); or wordPress do_action( 'say_kakapo', 'wordPress'); without any difference. Still, the WordPress do_action( 'say_kakapo', 'WordPress'); team uses it this way. In fact, there is a function called, capital_P_dangit that takes any other casing and converts it into WordPress do_action( 'say_kakapo', 'WordPress');. This way, you don’t have to worry about writing WordPress do_action( 'say_kakapo', 'WordPress'); the right way!

What’s a Kakapo?

Kakapo also called owl parrot, is a parrot that lives on the ground and like most birds that live on the ground, is from New Zealand (Wikipedia). It’s a fun word to say!