WordPress get_avatar filter to match logins

The get_avatar filter hook doesn’t apply only to the user with the ID 1 – I’m assuming you have this idea because of the example from page about the get_avatar at the codex –, but in reality it targets the user according to the context it is used in, so every possible user, not solely … Read more

how to overwrite next_post_link

You can’t easily change only the URL of that link, because there is no filter that will allow you to do that, but… next_post_link uses get_next_post_link. There are no filters in any of these functions, but… get_next_post_link uses get_adjacent_post_link and inside of that function you can see {$adjacent}_post_link hook. So now we can check docs … Read more

Dealing with the clickTrack event in wp-playlist.js in order to display audio download link on the playlist title row

Update: I found a super simple solution to my question several hours after posting it. It turns out a filter is not needed at all. Adding onclick=’event.stopPropagation();’ to the download link is all that is needed. It will allow for putting the download link on the same title row without affecting the ability to change … Read more

Security question – Display a General Custom Login Error Message

Add the following to your functions.php file. function my_custom_error_messages() { global $errors; $err_codes = $errors->get_error_codes(); // Invalid username. if ( in_array( ‘invalid_username’, $err_codes ) ) { $error=”<strong>ERROR</strong>: Custom Message Here”; } // Incorrect password. if ( in_array( ‘incorrect_password’, $err_codes ) ) { $error=”<strong>ERROR</strong>: Another Custom Message Here”; } return $error; } add_filter( ‘login_errors’, ‘my_custom_error_messages’); You … Read more

Re-order search results with posts_orderby filter and post meta value

Probably it’s just a JOIN problem: the SELECT query has no postmeta fields to order by. Try to implement the second answer from this question. That is, paste this code in your file. function custom_posts_join($join){ global $wpdb; $join .= ” LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id “; return $join; } add_filter( ‘posts_join’ , ‘custom_posts_join’);