Get new (not old) post inside transition_post_status hook

According to the Codex, if you use wp_transition_post_status() you will get both the old version and the new version. wp_transition_post_status( $new_status, $old_status, $post ) The ticket also says that the post type needs to support revisions for the save to work. Check the post type of the post objects before doing anything. If your post … Read more

$wp_query when new WP_Query

You are slightly confusing $wp_query global variable with WP_Query class/objects. $wp_query is an object instance of WP_Query, but not every WP_Query object has anything to do with $wp_query global. Function version of conditionals, such as is_search(), always act on main global query. You shouldn’t use them inside filters, since global state might be one thing … Read more

How to add a class to Buddypress avatars in the Activity stream? [closed]

When calling bp_loggedin_user_avatar(), you can set the ‘html’ attribute to false and it will return just the URL of the avatar (instead of the full HTML). Then you can style it how you want. Something like: $avatar_url = bp_loggedin_user_avatar( ‘html=false’ ); echo ‘<img class=”media-object” src=”https://wordpress.stackexchange.com/questions/157817/. $avatar_url .” width=”‘ . bp_core_avatar_thumb_width() . ‘” height=”‘ . bp_core_avatar_thumb_height() … Read more

Plugin hook breaks new WP 4.0 media library grid view?

Ok, I reworked the whole thing because I was obviously printing out my info prior to where I should have. It now looks like this: //SHOW SCREEN IF OPTION CHECKED add_action( ‘admin_notices’, ‘sbah_show_current_screen’ ); function sbah_show_current_screen() { $screenoptions = get_option(‘sbah_options’); if(isset($screenoptions[‘sbah_view_screen’][0])) { $takenscreen = $screenoptions[‘sbah_view_screen’][0]; } if(isset($takenscreen)) { if( defined( ‘DOING_AJAX’ ) && DOING_AJAX ) … Read more

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