Getting the post ID in parse_query

Thank you for your responses. After a bit of testing, I hooked onto WP (https://developer.wordpress.org/reference/hooks/wp/) which occurs near the end of the WordPress loading sequence, and it is now working: function wf_lang_query_check() { global $wp_query, $post; $lang = wf_get_lang(); if ( ( !is_admin() && $wp_query->is_main_query() ) && ( $lang && ( !in_array( $lang, wf_valid_lang() ) …

Read more

How to execute a hook asynchronously?

Yes, that’s what the WP Cron system does. It will fire an action/hook as close to a requested time as it can, and can do it once or multiple times. You would still have a hook that runs on profile_update but it wouldn’t send data to google spreadsheets, rather it would schedule a cron job …

Read more

Hook for inserting?

If you have access to the database, you could potentially create a trigger for that plugin-specific table. This bypasses the need for a hook. Depending on how they handle database schema updates, it might even stick around after a plugin update. I’ve never tried triggers on WP tables though, so take this with a grain …

Read more

How to perform action when plugin/theme editor is used?

The ajax action that runs on theme or plugin update is edit-theme-plugin-file so you should be able to hook into it by running code on the wp_ajax_edit-theme-plugin-file hook. add_action(‘wp_ajax_edit-theme-plugin-file’, ‘log_cowboy_coders’); function log_cowboy_coders() { $user = get_current_user_id(); if (!empty($__POST[‘theme’])) { // Log that someone is editing a theme } else if (!empty($__POST[‘plugin’])) { //log that someone …

Read more

What is deprecated_argument_run meant to do exactly?

As @sally-cj already hinted at in his comment this is used for debugging purposes, helping developers by notifying them of the use of deprecated arguments in their codebase. In core this is for example used to alert people of wrong arguments when using the REST API: https://core.trac.wordpress.org/browser/branches/5.2/src/wp-includes/rest-api.php#L177 But you could add your own function to …

Read more

How to use embed_content hook?

No, WordPress does not pass any arguments to the hook’s callbacks. And you can use that hook to display something after the embed excerpt is displayed. But this is of course, if the theme is using the default embed template for post embeds — with custom template, you could, if you want to, display the …

Read more