Updates and Errata

Q: Beginning WordPress 3 was written for 3.0. Does that mean it’s outdated?

A: The book is not very outdated at all, which is why we haven’t done a new edition. (Update: now it’s pretty outdated, and we’re doing a second edition.) I got lucky, and both 3.1 and 3.2 were relatively minor releases. (You can see the release announcements for more details: 3.1, 3.2.) There were a couple of small changes:

Most of the boxes on the Edit screens (like revisions, discussion, custom fields) are now turned off by default. You can turn any or all of them on again by checking them off in the Screen Options tab.

The Updates menu item has been moved from the Tools section to the Dashboard, so my instructions are a little off. The process of updating WordPress and its plugins is exactly the same, though.

The method of specifying labels and capabilities for custom post types changed in 3.1. If you’re interested in using custom post types, I’d recommend looking at the code examples in the Codex page for the register_post_type() function. You can download an updated version of my course type plugin, which was the example throughout that chapter.

Also, you no longer need to create page templates for custom post type archives; those archives are built in as of 3.1. You’ll need to include the has_archive argument in your register_post_type() function, and set it to true.

Other than that, very little has changed. Of course, the book doesn’t cover new things like post formats (3.1.), the internal linking feature (3.1), and the distraction-free writing mode (3.2).

Things that changed in between the printing of the book and the 3.0 release

There’s an important change to almost all my instructions. Late in the development process, the WordPress developers changed the wording of the main Posts and Pages screens, along with the navigation labels that get you there. Everywhere the book says to go to Posts → Edit or Pages → Edit, you’ll need to look for Posts → Posts or Pages → Pages instead. Also, the screens that list all the posts and pages are no longer labeled Edit Posts and Edit Pages; they’re just Posts and Pages. I find this a little confusing, but I’m told the change makes things a lot easier for translators.

(I wish that change had been made just a few days sooner. My manuscript was due to go into production on a Monday morning; the change happened late that afternoon. There was no time to update the text throughout the book and change the 70-odd screenshots that were affected. I’m really very sorry that such basic instructions are inaccurate throughout the book, and I promise I’ll update everything if we do a second edition.)

Also, there’s now useful text on the Help screens! Just click the Help tab next to the Screen Options in the top right corner of each screen, and you’ll find information on how to use the page you’re looking at.

Chapter 3: Dashboard and Settings

The Post by Email options, formerly part of the Writing Settings screen, has been disabled in multisite mode. You can turn it back on by creating a one-line plugin.

The section in this chapter on short URLs was written before the_shortlink() was introduced. That function is covered in Chapter 6, though.

Chapter 5: Importing Content

Most of the importers that used to be built in have been moved into plugins instead. There were a couple of reasons for this, one being that they can now be updated as needed, independent of the WordPress release schedule. You can find all the importers under the wordpressdotorg user’s profile on Extend. You don’t have to download them ahead of time, though. Just choose the one you want from the Importer screen, and you’ll be prompted to install the appropriate plugin.

Chapter 6: Basic Themes

There were some changes to the navigation menu feature after the book went to press. New top-level pages can be added automatically to the menus, if you check the box next to the menu’s name.

There were also some minor changes to the wording of the buttons on the menu management screen.

For enabling navigation menus in themes, add_theme_support('nav-menus') has been deprecated in favor of register_nav_menus().

Chapter 11: Performance and Security

One of the plugins I recommended, WP Tuner, did not work with the final release of 3.0 and still hasn’t been fixed, so don’t install it! It’ll break your site. (Remember, though, that when a plugin whitescreens your site, you can simply delete the plugin directory from wp-content/plugins and log back in.)

Chapter 12: Custom Content Types, Taxonomies, and Fields

The ‘helps’ argument is now part of the ‘labels’ array, along with ‘name’ and ‘singular_name.’ See the Codex page for the register_post_type() function for updated information on the various arguments.

19 Comments

  1. Errata suggestions:

    Chapter 6, Listing 6-12, Line 4

    comment_content)) : ?>

    Should be comment_content) : ?>

    Chapter 6, Listing 6-13
    Will only work if
    1) functions.php has register_sidebar(); function
    2) index.php in Listing 6-3 has
    <?php if ( !dynamic_sidebar('sidebar') ) :

    instead of

    Keep it up.

  2. Hello

    I wonder if there is a mistake in the code in listing 12-25 (page 341).

    When I tested the code it wouldn’t work. I narrowed it down to around line 60:

    `add_action( ‘save_post’, ‘save_course_meta_data’ );`

    Should this be moved to above the save_course_meta_data function and replaced with:

    `add_action( ‘admin_menu’, ‘course_meta_boxes’ );`

    Still learning so I could be completely wrong but it seemed to fix the problem for me as far as I can tell.

  3. Oh and I meant to say – absolutely LOVE the book! It has helped me to understand things that I have been struggling with for months.

    Have a good basic knowledge of WordPress but am still developing my knowledge in customising it to do things at the next level using functions and queries etc.

    Thank you!

  4. Hi, me again. My suggested fix above didn’t seem to work plus the category isn’t displaying in the college column.

    I copied the code EXACTLY as it was in the source code document.

    • Thanks for letting me know, Lisa. I’m a few days behind on things, but I will take a look at this as soon as I can.

      Glad the book is helping!

      • No problem. Just so you know I kept trying to figure out why the complete code on page 341 didn’t work and wasn’t successful.

        I did quite a bit of research to see what others did and put together something else that sort of works (still doesn’t display the custom category in the New Page column) but I suspect there were things in the code I put together that were wrong as well. If you want me to send what I have done to you in contact me via my email.

        When you have had a chance to look at this I would be keen to try your option again and not happy with min.

        Thanks!

  5. First off, thanks for a great book, I’m still learning more about PHP and this has helped.

    I think there is an error on page 198, where two versions of code are compared. They are supposed to be a long and short way of doing the same thing, but they do not do the same thing.

    Here are the two bits of code from the book:

    <input type="radio" name="simplex_options[cols]" value=”left2″ /> 2 columns, sidebar left

    <input type="radio" name="simplex_options[cols]" value=”left2″ /> 2 columns, sidebar left

    They are supposed to be different ways of doing the same thing. However if $options['cols'] == ‘left2′ the first version will output the following html:

    2 columns, sidebar left

    The second piece of code will output this html:

    2 columns, sidebar left

    • So now that I see my post, I realize my code examples in the post are stripped of the php.
      I’m not sure how to add code snippets to the post without them being stripped.

      Essentially the first code example outputs: checked=”checked” inside the radio button.
      The second example does not, it only outputs: value = “left2″, which should be included outside the php regardless.

      I hope that makes sense?

  6. Hi Stephanie,

    Firstly, thanks for a fantastic book! As a complete WordPress/PHP beginner, it has opened up a whole new world for me.

    Over the last few days I’ve been working with Chapter 12, and managed to successfuly set up a custom post type with custom taxonomies, and even my own meta data fields.

    Only problem I’ve had is with my new meta fields failing the nonce test. Whenever I tried to ‘Add New’ (whether one of my custom posts, or even traditional posts or pages) I kept getting the “Are you sure you want to do this” error.

    After much pondering, I narrowed the issue down to the “check nonces” bit of your code, with the “check_admin_referer” lines. I noticed on the updated code you’ve linked to somewhere above, you’ve commented out this bit of the code. I followed your lead, commented it out in my code, and now it all works great.

    BUT, what have I done? I’m a little worried that I’ve removed the security of nonces from my meta boxes. Is it ok to leave it like this? (Please bear in mind I didn’t know what a nonce was until yesterday. It means something quite different here in the UK).

    I’d love to hear your thoughts.
    Thanks again for an excellent book!

    • Hi, Mark! You’re quite right; it’s a bit less secure without the nonces. I was in a big hurry that day and didn’t take the time to track down the error, but it was fairly simple: everything except the autosave and capability checks needs to be wrapped in an if statement that checks whether we’re looking at the custom post type. (Why: the meta boxes don’t appear on posts or pages, so those will always fail the nonce checks.)

      It should look something like this:

      function save_course_meta_data( $post_id ) {
      	// ignore autosaves
      	if (defined('DOING_AUTOSAVE') &amp;&amp; DOING_AUTOSAVE) return $post_id;
      
      	// check capabilites
      	if (isset($_POST['post_type']) &amp;&amp; 'course' == $_POST['post_type'] &amp;&amp; !current_user_can( 'edit_post', $post_id ) )
      		return $post_id;
      	
      	if (isset($_POST['post_type']) &amp;&amp; 'course' == $_POST['post_type']) {
      		// check nonces
      		check_admin_referer('course_code_nonce', '_course_code_nonce');
      		check_admin_referer('instructor_nonce', '_instructor_nonce');
      			
      		// save fields
      		// ...
      	}
      }
      

      I’ve updated the sample plugin, so you can download a fresh .zip and see the differences.

    • – oh, and I know what you mean about the word “nonce.” I wish the computer scientists had come up with something else! I got an astonished query from my UK-based editor when I turned in that chapter!

  7. Hi, Stephanie, great book and great resource full of handy tips!

    I have one question for you though.
    on p. 279 Roles in Action is written:
    “For authors, it’s a little more complicated. Since they are not allowed to publish their own posts, they
    must submit them for review”

    Are you sure this is correct? In the Codex it says that one of the caps of an author is publish_posts

    • Oh dear, does it say that?! (I don’t have my copy handy.) That’s true of Contributors, but you’re right, Authors can publish their own posts. (Just not pages.)

  8. I’m using your book in a class at Wake Tech Community College in Raleigh, NC. I got the book delivered on a Kindle device and sometimes have trouble reading the screen snapshots, even if I open the book in a Kindle reader on a traditional PC.

    It can be very frustrating to miss content from the images. For instance, I can’t make out the details in the samples showing shortcodes they aren’t much use to me.

    Are the images available in some other form?

Leave a Reply

Required fields are marked *.