Blog Updated to WordPress v4.2.1 and Other Changes

WordPress came out with version 4.2.1 today to address a security issue. I have thus updated my blog to that version. I have also made a couple other changes.

First, Version 4.2 introduced this Emoji stuff which I didn’t really care for and it broke some of my smileys in older posts, namely the “confused” one: :???: (or :???: as one of the textual representations). It came across as an unrendered character on my system instead of the smiley image icon_confused.gif. I found a new plugin called Classic Smilies which removes the Emoji CSS and JS from loading and restores the older images.

Second, I decided to change the character set in my blog’s MySQL database from latin1 to utf8 which has been the default for some time. When I started my blog, latin1 was the default. I found Fixing a MySQL Character Encoding Mismatch and followed it. Here’s what I did:

  1. I used SQLyog, which I bought a long time ago, to first backup the database to another database and then to dump the original database as a SQL file.
  2. Edited the SQL file and changed all the CHARACTER SET= latin1 and CHARSET=latin1 statements to utf8 instead.
  3. Emptied the database to remove all tables and data.
  4. Altered the database to make the default charset utf8.
  5. Restored the database from the edited SQL file.

Now, all the fields in the database have a charset of utf8 and collation of utf8_general_ci. So far everything looks normal. I actually converted the database before updating to 4.2.1. :)

How To Exclude Categories in WordPress Archives Drop-down

This is a follow-up post to my Excluding Categories from Different Parts of WordPress post a while back. The problem I was having is that the posts in my Testing and Daily Tweets categories where being counted and shown in the Archives drop-down widget. For example, it showed 4 posts in April 2011. When selecting April 2011 in the drop-down, you would get the “404 Not Found” page since all 4 posts belonged in the Daily Tweets category which is excluded from showing in the main blog, except when being accessed via the Category drop-down.

After some searching, I found the following thread: wp_get_archives and Conditional Tags and adapted the code as follows in my theme’s functions.php file:

add_filter( 'getarchives_where', 'customarchives_where' );
add_filter( 'getarchives_join', 'customarchives_join' );
function customarchives_join( $x ) {
	global $wpdb;
	return $x . " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
function customarchives_where( $x ) {
	global $wpdb;
   // 61 = Daily Tweets, 74 = Testing
	$exclude = '61,74'; // category id to exclude
	return $x . " AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id NOT IN ($exclude)";

Now, it does not count those posts in the Archives drop-down. Yay! :)

Blog Updated to WordPress v4.2

A couple days after WordPress 4.1.2 came out, WordPress 4.2 did. I have thus upgraded my blog to it. They also updated most of the default themes including the one I use, TwentyTwelve. I did a file comparison and noticed that the header.php file was the only one I needed to update for my child theme.As always, I did a complete database and file structure back-up before doing anything.

One thing I’ve noticed while making this post is the highlighted text is automatically placed into the “Link text” field of the Insert/edit Link button. Anyway, I’ll let you read the WordPress 4.2 stuff for all the changes and fixes. :)