Recall & Review
beginner
What is an action hook in WordPress?
An action hook is a way to add or change WordPress behavior by running custom code at specific points during WordPress execution.
Click to reveal answer
beginner
What does the
wp_head action hook do?The
wp_head hook runs in the <head> section of a WordPress theme. It lets you add scripts, styles, or meta tags before the page loads.Click to reveal answer
intermediate
When is the
init action hook triggered?The
init hook runs after WordPress has loaded but before any headers are sent. It's used to initialize plugins, register post types, or start sessions.Click to reveal answer
beginner
What is the purpose of the
wp_footer action hook?The
wp_footer hook runs just before the closing </body> tag. It is used to add scripts or code that should load at the end of the page.Click to reveal answer
beginner
How do you add a function to an action hook in WordPress?
Use the
add_action('hook_name', 'your_function') function. This tells WordPress to run your function when the hook runs.Click to reveal answer
Which hook is best to add custom code inside the <head> section of a WordPress theme?
✗ Incorrect
The wp_head hook runs inside the <head> section, perfect for adding styles or scripts.
When does the
init action hook run?✗ Incorrect
The init hook runs after WordPress loads but before headers are sent.
Which hook is used to add code just before the closing </body> tag?
✗ Incorrect
The wp_footer hook runs just before the closing </body> tag.
How do you attach your function to a WordPress action hook?
✗ Incorrect
Use add_action to attach your function to an action hook.
Which hook is NOT typically used for front-end page modifications?
✗ Incorrect
admin_init runs in the admin dashboard, not on the front-end.
Explain what an action hook is in WordPress and give two examples of common action hooks used in themes.
Think about points in page load where you can add code.
You got /3 concepts.
Describe how you would use the
init action hook in a plugin.Init runs early, before headers.
You got /3 concepts.