Hook all http requests

How do I hook all http requests in wordpress? More specifically I am interested in examining an http header in the request and then potentially modifying headers in the request so that other plugins that rely on certain headers can work properly. Many answers discuss hooking responses, but I need to hook the request, not … Read more

Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook

UPDATE: I have worked out my implementation of the selected answer at the bottom of this post. I’m implementing a sorting algorithm based on Reddit’s hotness algorithm, in addition to a time-decay (like Hacker News hotness algorithm). The code I am currently satisfied with is a result of trial and errors in some Excel sheets … Read more

Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?

I need to intercept the scripts that are added in the footer and head through the wp_footer() and wp_head() functions, something like add_filter(‘wp_footer’, my_function) and then in my_function, I would check the name of the registered script and then perform an action, in that case would read the contents of the script.js file and insert … Read more

Enforcing canonical URLs with multiple custom post types

I’m working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the ‘parent’ of the others. For example, say I have a custom post type called ‘book’ and another one called ‘character’, and say I want to have the following custom … Read more