Wordpress Hooks

  • muplugins_loaded
    • no after hook. 
    • This hook is triggered after Must-Use plugins are loaded and does not have a corresponding "after" hook.
  • plugins_loaded
    • no after hook. 
    • It indicates that all active plugins have been loaded. There is no specific "after" version.
  • setup_theme
    • after_setup_theme. 
    • The after_setup_theme hook is specifically designed to run after the theme has been initialized.
  • after_setup_theme
    • this is the after hook for setup_theme
  • unload_textdomain
    • no after hook
    • This hook is specifically used to unload a text domain, removing all translations associated with it from memory. It's particularly useful in scenarios where you need to switch translations or unload them entirely to free up resources or manage memory in a dynamic multilingual environment.
  • load_textdomain
    • no after hook
    • load_textdomain is a crucial function for setting up internationalization by loading a .mo file (which contains compiled translation data) into the text domain specified.
  • init
    • no after hook
    • This hook is used to trigger functions after WordPress has finished loading but before any headers are sent. There is no "after_init" hook, but wp_loaded often serves a similar purpose, indicating the system is fully loaded.
  • widgets_init
    • no after hook
    • The widgets_init action hook in WordPress is used to initialize widgets and register widget areas (also known as sidebars).
  • register_sidebar
    • this one is not a hook. it is a function that is called by other hooks/events
  • wp_loaded
    • no after hook
    • This hook is used to indicate that WordPress and all its plugins and themes have been fully loaded and instantiated.
  • parse_request
    • no after hook
    • This hook allows developers to manipulate the WP query object immediately after the query variables have been parsed.
  • send_headers
    • no after hook
    • The send_headers action hook in WordPress is used to modify HTTP headers before they are sent to the browser. This hook provides a mechanism to intercept and alter HTTP headers or perform actions based on header information. Its use implies that it is effectively the point at which you can last modify headers before they are sent out as part of the HTTP response.
  • pre_get_posts
    • No after hook
    • It is used to adjust the query parameters before the query is actually executed.
  • posts_selection
    • no after hook
    • The posts_selection hook in WordPress is a somewhat lesser-known action that is triggered just before the main WordPress query object (WP_Query) retrieves posts from the database. It allows you to perform actions or modify the environment immediately before posts are selected by the query. 
  • posts_request
    • no after hook. (this one is a filter, not a hook)
    • The posts_request hook in WordPress is a filter, not an action, which is used to modify the SQL query string that is generated by WP_Query just before it is sent to the database. This filter provides a way to adjust or completely replace the SQL query used to retrieve posts.
  • the_post
    • No after hook
    • This hook is used primarily within the loop to modify the global $post object as needed.
  • wp
    • No after hook
    • This hook runs once WordPress has set up all query variables and the current user, but before the actual query execution.
  • template_redirect
    • No after hook
    • This is used to redirect users before a template is loaded. It is a point to hook in and change the template that will be included but does not have an "after" counterpart.
  • get_header
    • no after hook
    • The get_header action hook in WordPress is used specifically to perform actions just before the header template file (header.php) is loaded. It is primarily utilized for enqueuing scripts, adding inline styles, or performing any setup required specifically for the header. 
  • wp_head (loading of scripts and styles)
    • no after hook
    • The wp_head action hook in WordPress is a crucial part of the theme and plugin ecosystem, providing a place to inject elements into the <head> section of HTML documents. This hook is used extensively to add metadata, link tags, inline styles, scripts, and other elements essential for a website's functionality and performance.
  • get_sidebar
    • no after hook
    • The get_sidebar action hook in WordPress is used to include sidebar template files, typically named sidebar.php, within a theme. This hook allows developers to execute code before and after the sidebar is loaded
  • get_footer
    • No after hook
    • The get_footer action hook in WordPress is used similarly to get_header, specifically for including the footer template file, typically named footer.php, within a theme. This hook allows developers to execute code just before the footer is loaded.
  • wp_footer
    • No after hook
    • The wp_footer action hook in WordPress is an essential part of theme development, used to insert necessary scripts, tracking codes, and other types of content into the footer of a WordPress site just before the closing </body> tag. It represents one of the last hooks you can use to output HTML or scripts before the HTML document ends.
  • wp_print_footer_scripts
    • No after hook
    • The wp_print_footer_scripts action hook in WordPress is used specifically for printing scripts enqueued for the footer. This hook is an essential part of WordPress's script loading mechanism, ensuring that scripts designated to be output in the footer are done so at the correct time.
  • admin_bar_menu
    • No after hook
    • The admin_bar_menu action hook in WordPress is used to manipulate the WordPress admin bar, also known as the Toolbar. It allows developers to add, remove, or modify items in the admin bar. 
  • wp_before_admin_bar_render
    • No after hook
    • The wp_before_admin_bar_render action hook in WordPress is specifically used to execute actions just before the WordPress admin bar (Toolbar) is rendered. This hook provides a timely opportunity to make last-minute adjustments or additions to the admin bar before it's output to the HTML of a page.
  • wp_after_admin_bar_render
    • Although there is no after hook for wp_before_admin_bar_render, this hook essentially serves that same purpose since it fires immediately after the admin bar is rendered.
  • shutdown
    • The shutdown action hook in WordPress is used to perform actions right before PHP finishes executing a script. It runs after WordPress has completed all its tasks and is about to conclude the page request. This is typically the last action hook that WordPress fires, making it ideal for tasks that need to be performed at the end of the execution cycle.

No comments:

Post a Comment

} else { }