Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Code
  2. WordPress

Fifty Actions of WordPress – Series Finale

This post is part of a series called Fifty Actions of WordPress.
Fifty Actions of WordPress – 50 Examples (41 to 50)

Welcome to the series finale of "Fifty Actions of WordPress!" Over the last few weeks, we've been looking at WordPress actions - what they are, how to use them, and 50 of those that exist along with examples of how to put them to work for us.

In this last part, we're going to review what we learned and summarize all the 50 actions with a couple of words for each one.

Let's begin!

Part One: An Introduction to WordPress Actions

We started with a simple introduction to the world of actions in WordPress. Since the whole system is actually pretty easy, it wasn't hard to introduce it at all. We learned the following seven essential functions:

  • add_action() which allows us to hook our functions to existing action hooks,
  • remove_action() which removes a function from an existing action hook,
  • remove_all_actions() which removes all functions from an action hook,
  • do_action() which lets us create new action hooks,
  • do_action_ref_array() which lets us create new action hooks using an array for arguments,
  • did_action() which counts the number of times an action is fired,
  • and has_action() which checks if anything's hooked to an action.

50 Great Examples for 50 Great Actions

Over the course of the following five articles, we were introduced to 10 actions in the core with examples for every single one of them. 

Let's remember what each one was good for:

Part Two: Fifty Actions of WordPress – 50 Examples (1 to 10)

  1. init handles the initialization of WordPress – just before the headers are sent.
  2. send_headers sends the headers and lets us add extra HTTP headers.
  3. after_switch_theme is fired off right after the user switches themes.
  4. manage_posts_custom_column gives us the possibility to add custom columns to the "All Posts" page in the admin panel.
  5. admin_head allows us to inject code to the <head> of the pages in the admin panel.
  6. wp_footer makes it possible for us to run code through the wp_footer() function.
  7. wp_enqueue_scripts is the action to enqueue scripts and styles correctly to the front-end.
  8. admin_notices lets us display admin notices in the back-end.
  9. widgets_init initializes the widgets of WordPress and allows us to modify it.
  10. delete_user is called right after a user is deleted from the database.

Part Three: Fifty Actions of WordPress – 50 Examples (11 to 20)

  1. wp_default_styles controls the process of loading of the default WordPress styles.
  2. get_footer makes it possible for us to tamper with the get_footer() function.
  3. admin_init is fired off each time an admin page is loaded, giving us the opportunity to get creative with it!
  4. wp_authenticate runs to authenticate a user when they log in.
  5. login_form handles the login form, giving us the chance to customize it.
  6. admin_menu lets us add/remove menu items (or sub-menu items) to the main administration menu.
  7. wp, the action with the shortest name, runs after a query is parsed but before any template is executed.
  8. admin_head-(page_name) allows us to control the <head> of the admin page which is specified in the name of the action (page_name).
  9. wp_before_admin_bar_render, as its name suggests, runs before the Toolbar (formerly Admin Bar) is rendered.
  10. profile_update is called right after a profile is updated in the database.

Part Four: Fifty Actions of WordPress – 50 Examples (21 to 30)

  1. pre_get_posts is fired off before the get_posts() function, allowing us to play with the query.
  2. transition_post_status is the action that controls the transition of post statuses, like "draft to publish", "future to private" and such.
  3. admin_enqueue_scripts is used to enqueue scripts and styles correctly in the admin panel.
  4. save_post executes right after a post is saved to the database.
  5. add_meta_boxes_(post_type) lets us add meta boxes to a custom post type's post edit screen.
  6. activity_box_end is fired off at the end of the "At a Glance" (formerly "Right Now") section.
  7. wp_meta is the action that allows us to tamper with the default "Meta" widget.
  8. wp_dashboard_setup initializes the Dashboard, the homepage of the admin panel, and makes it possible for us to monkey with it.
  9. set_current_user is part of the pluggable wp_set_current_user function which changes the current user by ID or name.
  10. plugins_loaded runs right after all the activated plugin files are loaded.

Part Five: Fifty Actions of WordPress – 50 Examples (31 to 40)

  1. wp_default_scripts handles the execution of default WordPress scripts and lets us tamper with the process.
  2. wp_head makes it possible for us to run code in the wp_head() function.
  3. after_setup_theme is called each time a file of the activated theme is loaded.
  4. manage_media_custom_column gives us the opportunity to add extra columns to the file list in the Media Library.
  5. comment_(old_status)_to_(new_status), which has two variables in its name, executes after a comment's status is changed in the database.
  6. template_redirect is called when a "page template" is loaded.
  7. do_feed handles the feeds of your WordPress installation.
  8. admin_bar_menu allows us to manipulate the Toolbar.
  9. wp_list_categories makes it possible for us to control the behavior of the default "Categories" widget.
  10. pre_get_search_form runs just before the search form in your theme is loaded.

Part Six: Fifty Actions of WordPress – 50 Examples (41 to 50)

  1. admin_head-(plugin_page) runs in the <head> of the plugin pages you specify.
  2. pre_ping is called before a ping is processed.
  3. get_header makes it possible for us to run code in the get_header() function.
  4. login_head executes in the <head> of the login page and lets us control it.
  5. admin_footer is fired before the </body> tag in admin pages.
  6. login_enqueue_scripts is used to enqueue scripts and styles correctly in the login page.
  7. manage_users_custom_column gives us the chance to add custom columns to the Users table in the "All Users" page.
  8. activated_plugin is fired off each time a plugin is activated.
  9. admin_color_scheme_picker controls the behaviour of the "color schemes" picker in the user profile editing pages.
  10. wp_logout runs when a user logs out.

Part Seven: The End

You guessed it, you're reading part seven right now! Joking aside, here we are at the end of the series. I really, really hope you enjoyed this series as much as I did while writing the whole thing.

Contributions of all types are appreciated, by the way. You can:

  1. Share your thoughts on this series by commenting below,
  2. Suggest new filters and example ideas for an "addendum" part or two,
  3. Offer ways to improve my writing if you caught a mistake, incoherency or ambiguity in my posts,
  4. And share these tutorials anywhere for everyone to see and learn about WordPress filters!

Thank you for taking time to read the series - hopefully it serves as a point of education and of reference moving forward!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.