How to display message (with switch_theme hook) after deactivating My theme?

It’s impossible, because after deactivation your theme isn’t even loaded! It’s possible, but hacky. Essentially, we unset the action param, load in the themes admin page & then exit before the redirect-on-success occurs. add_action( ‘switch_theme’, ‘wpse_60972_theme_deactivate_message’ ); function wpse_60972_theme_deactivate_message() { $msg = ‘ <div class=”error”> <p>Your theme has been DEACTIVATED</p> </div>’; add_action( ‘admin_notices’, create_function( ”, … Read more

How to use the ‘comments_number’ filter?

The filter you mention is used by the end of get_comments_number_text. As you can see from the source the number of comments is passed through the filter, allowing you to completely change the default text. Like this: add_filter (‘comments_number’, ‘wpse89257_comments_number’, 10, 2); function wpse89257_comments_number ($output, $number) { if ($number == 0) $output=”0 Comments”; elseif ($number … Read more