Hooking after get_header()

I hate answering questions in the negative because it is easy to go wrong, but there is no core hook that does that– at least no hook that I have ever seen. I admit it could be handy for a couple of things though. wp_header() loads the theme’s header file. That is about it. It … Read more

WooCommerce New customer email Hook? [closed]

There is no actions/filters to hook to. You need to override standard WC_Email_Customer_New_Account class and implement your own logic. To do it you need to create your own class which will inherit that class and register it. class WPSE8170_Email_Customer_New_Account extends WC_Email_Customer_New_Account { function trigger( $user_id, $user_pass=””, $password_generated = false ) { // do what you … Read more

How to send an automated user ‘inactivity’ email?

There are three main parts to your question: Log the user last login time Schedule a cron event Send email if contributors and authors haven’t logged in within 20 days The first step is adding user meta to track the last login. WordPress does not track the last time a user logs in, so we’re … Read more

How to override languages files in wp-content/languages/themes with child theme

Since WP 4.6 load_theme_textdomain() (and consequently load_child_theme_textdomain()) will give priority to .mo files downloaded from WP’s online translation platform (translate.wordpress.org). Due to some new code (here, on line 769) these functions will completely ignore your local .mo files if the textdomain is found in the general languages/ directory. You can, however, use the more basic … Read more

Can I trigger the publish_post hook by using wp_insert_post?

It’s triggered in wp_publish_post() that calls: wp_transition_post_status( ‘publish’, $old_status, $post ); that fires up action calls, dynamically with: do_action( “{$new_status}_{$post->post_type}”, $post->ID, $post ); where “{$new_status}_{$post->post_type}” becomes “publish_post” in your case.

How can i trigger an action manually?

Use do_action, you can just: do_action( ‘my_action’); if your action has a callback function that need arguments say: function my_callback( $an_array ){ //use the array for something here var_dump($an_array); } add_action( ‘my_action’, ‘my_callback’ ); you can specify it in the do_action like this: do_action( ‘my_action’, array( ‘array_for_callback’) );

Seeking Hook Whenever a Custom Taxonomy Term Has Been Added

create_category runs when a new category is created, in turn set_object_terms fires after a terms have been set to object. The hooks you are looking for are: create_{$taxonomy} – new term in a specific taxonomy is created created_{$taxonomy} – new term created, term cache has been cleaned create_term created_term

Add custom URLs to WordPress’s XML sitemap

Sitemap Provider It’s possible to create a so called custom sitemap provider and register it with wp_register_sitemap_provider(). It’s helpful to look at the core setup, e.g. for the WP_Sitemaps_Posts provider and also the dev notes. Basic Example – Sitemap with custom URLs Here’s a very basic example that adds the wpse provider that extends WP_Sitemaps_Provider, … Read more

How to modify an add_action() inside a loop of core function

Use the filter hook bp_members_signup_error_message Try: function signup_error_change( $error_message ) { $error_message = str_replace(‘<div class=”error”>’, ‘<span class=”val-error”>’, $error_message); $error_message = str_replace(‘</div>’, ‘</span>’, $error_message); return $error_message; } add_filter(‘bp_members_signup_error_message’, ‘signup_error_change’, 1, 1);

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