the_posts hook, which set of posts?

I’d say it’s perfectly fine to do it the way you’re doing it now, that is function my_the_posts($posts, $query = false) { if( is_search() ){ // do your thing here } return $posts; } add_filter( ‘the_posts’, ‘my_the_posts’ ); Don’t worry about those excerpts in the footer, even though they may be part of the search … Read more

Custom function for “Submit for Review” hook

You need Post Status Transitions actions function notify_me_for_pending( $post ) { $user_info = get_userdata ($post->post_author); $strTo = array (’[email protected]’); $strSubject=”Fstoppers: ” . $user_info->user_nicename . ‘ submitted a post’; $strMessage=””” . $post->post_title . ‘” by ‘ . $user_info->user_nicename . ‘ was submitted a post for review at ‘ . wp_get_shortlink ($post->ID) . ‘&preview=true. Please proof.’; wp_mail( … Read more

How to use the post_updated hook before and after arguments

First off you are using the function wrong. The function is tied to an action within wordpress whenever you use the add_action function. In this case you have added it to the post_updated action. Basically your check_values function gets added to a queue which will then get called by the action when its time to … Read more

do_action and hook methods

Your analogy here is partially correct, but incomplete: I understand that when do_action is called wp looks for all registered listeners and invokes them according set priority. You need to consider what happens when you call add_action. WordPress never searches for the add_action statements, it has those in a list. When you call add_action, it … Read more

Why is save_post hook not running?

Try this in your theme’s functions.php file, or a .php file of a plugin that you may be writing: add_action(‘save_post’, ‘xxx_save_meta_box’); function xxx_meta_box_callback() { add_meta_box(‘xxx-meta’,’xxx Details’,’xxx_meta_box’,’xxx-post-type’,’side’,’default’); error_log(‘meta box cb’); } function xxx_save_meta_box($post_id, $post) { error_log(‘running …’); die(‘OK!!!’); }

action lifecycle

The order and appearance of actions depend on the page and the loaded files. get_search_form() for example fires an action ‘get_search_form’ and (oddly enough) also a filter ‘get_search_form’. But if no search form is loaded the action will not be available. The only way to really know which actions are available is to look at … Read more

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