Tag: hooks

Practical Uses of pre_get_posts

In WordPress, pre_get_posts is an action that makes it possible to modify an existing WP_Query, before that query is actually run. pre_get_posts offers some solutions that are more performant than writing a custom WP_Query, and enables solutions to other problems that would be quite difficult otherwise.

Make Your Site Faster with Async and Deferred JavaScript: Introducing script_loader_tag

Today I’m going to discuss a new, and very nice, site speed improvement that became possible in WordPress 4.1. What changed? The introduction of a new filter, script_loader_tag. This filter lets us easily change the HTML markup of enqueued script elements—that is, of JavaScript files that were correctly added into a WordPress site using WordPress’s wp_enqueue_script function.

Adam Brown’s Hooks List

There’s not really a shortage of ways to find WordPress hooks, filters, functions, and more. It was actually Jeff Chandler’s story about Hookr.io — a new entrant into the field — that reminded me of this one which I remember from years ago. It’s not especially pretty, but it’s a deep resource that makes it easy to jump from a list of hooks to where they sit in the source once you get the hang of it.