Get log of function/method calls made by do_action() on WordPress initialization

I don’t believe there is a way to do this via a plugin (at least in a way that will get around 500 type errors, which is why I originally looked into this), but the section of code where the hook callback gets called is in wp-includes/plugin.php in the do_action function: https://github.com/WordPress/WordPress/blob/master/wp-includes/plugin.php#L453 This got updated … Read more

Add parameter (time) to oembed

No extra code needed. Simply include the timestamp parameter onto the YouTube link, with the format of hash t equals number m number s. Or in other words: #t=1m02s The numbers are minutes and seconds. Example of a rickroll pre-fast-forwarded to 1 minute in: http://www.youtube.com/watch?v=dQw4w9WgXcQ#t=1m0s YouTube’s oEmbed endpoint seems to handle this just fine and … Read more

add_action for unknown custom post types

The first one does not work because to use that format you need double quotes. add_action( “publish_{$custom_post_type}” , ‘run_new_post_code’ ); That will let the wrapped variable name be processed properly. To do something for all custom post types you probably just need to grab the list of custom post types and cycle through them adding … Read more

Help to change the text for new website notification (wpmu_welcome_notification)

Here’s an untested example, how you could modify the email body to your needs: add_filter( ‘update_welcome_email’, function( $welcome_email, $blog_id, $user_id, $password, $title, $meta ) { // Override the email body: $welcome_email = __( ‘Dear User, Your new SITE_NAME site has been successfully set up at: BLOG_URL You can log in to the administrator account with … Read more

Manage users custom column add class “num”

The solution is simple. Add the word num when defining the column like this: // Add users table header columns add_filter( ‘manage_users_columns’, ‘gtp_users_table_columns’ ); function gtp_users_table_columns( $defaults ) { $defaults[‘purchased-leads num’] = __( ‘Purchased leads’, ‘gtp_translate’ ); return $defaults; } // Add users table lead purchase column content add_action( ‘manage_users_custom_column’, ‘gtp_users_table_content’, 10, 3 ); function … Read more

What’s hook to use immediately after a user is authentcated [duplicate]

juste before testing login and password, you have the action wp_authenticate: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_authenticate juste after test and only if logging is successful, the action wp_login: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login and after logging, you can also modify the URL with the filter login_redirect: https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect

Pass info from functions.php to plugin

Plugins are loaded before the theme which means that your apply_filters won’t have any actual callbacks registered to it. Instead, you need to call your apply_filters sometime after the theme has been loaded. Something like this: /* Your plugin’s file: */ add_action( ‘init’, ‘my_lovely_funky_filters’ ); function my_lovely_funky_filters() { /* Fire our callbacks */ $value = … Read more