Generic plugin (de)activation hook?

do_action( ‘deactivate_’ . $plugin, $network_deactivating ); Fires as a specific plugin is being deactivated. do_action( ‘deactivated_plugin’, $plugin, $network_deactivating ); Fires after a plugin is deactivated. The above hooks don’t fire when silent mode is activated (eg: during an update). Refer: deactivated_plugin

Generating robots.txt dynamically

I just tested the ‘robots_txt’ filter on a single installation to modify the output of the virtual /robots.txt that WordPress displays and it worked fine for me: add_filter(‘robots_txt’, ‘wpse_248124_robots_txt’, 10, 2); function wpse_248124_robots_txt($output, $public) { return ‘YOUR DESIRED OUTPUT’; } What is really happening when you try to reach /robots.txt? Does it display the default … Read more

Identifying the priority of style.css so I can make a small CSS file load last

When you properly enqueue a file, an instance of the wp_styles (more on this) class is created. The priority of actions is ignored. So it doesn’t matter if you write anything like add_action (‘wp_enqueue_scripts’,’function_adding_main_style’,10); add_action (‘wp_enqueue_scripts’,’function_adding_small_style’,11); The reason is exactly the existence of the dependency system. WP first collects all enqueued style files and then … Read more

I can’t find where a hook is being defined in a plugin – Easy Digital Downloads

in includes/actions.php there’s function edd_post_actions() { $key = ! empty( $_POST[‘edd_action’] ) ? sanitize_key( $_POST[‘edd_action’] ) : false; if ( ! empty( $key ) ) { do_action( “edd_{$key}”, $_POST ); } } add_action( ‘init’, ‘edd_post_actions’ ); in templates/shortcode-profile-editor.php there’s ..input type=”hidden” name=”edd_action” value=”edit_user_profile” .. which, if the two are used together, would make do_action( ‘edd_edit_user_profile’, … Read more

Intercepting a add_action

You can use has_action(). It returns the priority of the hook if it exists, otherwise false. So check that the priority is not equal to false (and not just false-y, or being hooked at 0 will appear false) then use that to remove the hook. $priority = has_action( ‘publish_post’, ‘myCustomFunction’ ); if ( $priority !== … Read more

WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end

Since this isn’t getting much action I’ll put our band-aid fix as the current solution. Problem 1 Solution The added item meta data shows on the order confirmation page and does not show on the confirmation email. We solved this by utilizing the woocommerce_order_item_meta_end hook to add the extra item meta. Problem 2 Solution Adding … Read more

Post-Registration, post-meta hook?

You can use user_register add_action(‘user_register’, ‘wpse42506_user_register’, 10, 3); function wpse42506_user_register( $user_ID ) { // do stuff here } If you want to just use the user information, you can use get_userdata http://codex.wordpress.org/Function_Reference/get_userdata If you need more control, you can initiate a new WP_User http://codex.wordpress.org/Class_Reference/WP_User

In what sequence are the hooks fired when a post is “published”?

What exactly do you mean with “published”? One thing you can try is this : http://planetozh.com/blog/my-projects/wordpress-hooks-filter-flow/ The script runs in your WordPress root (or in /wp-admin/ if you prefer) and enumerates filters that are loaded in your blog. Hooks are displayed alphabetically, and for each hook, active filters (or actions, they’re the same) are listed … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)