The Downside of Open Source: Transparency

Posted on January 2, 2010

One aggravating thing in the open-source software world is that, unlike closed-source software, when you encounter strange behavior, you can actually research and find out why that behavior was chosen. The aggravating part happens when you find out that the decisions are made arbitrarily.

Take WordPress, for example. While creating this blog, I wanted to create “previous” and “next” links for my articles. Luckily, WordPress has functions called next_post_link and previous_post_link. Unfortunately, these functions do not work on the homepage (is_home vs is_single). This seems strange, especially since it is not documented, and the default configuration of WordPress is to have your posts displayed on the homepage. Why should these functions not work on the homepage, especially when analogous functions, such as next_posts_link (note the extra “s”) do?

As it turns out, there is no reason. It’s completely arbitrary.

WordPress is open source, and their entire source code history is available, so I took a look. It appears that when the next/previous_post_link functions were added by “rboren” in r1557:

function get_previous_post($in_same_cat = false, $excluded_categories = '') {
    global $post, $wpdb;

    if(! is_single()) {
      return null;

    $current_post_date = $post->post_date;
    $current_category = $post->post_category;

    $sqlcat = '';
    if ($in_same_cat) {
      $sqlcat = " AND post_category = '$current_category' ";

    $sql_exclude_cats = '';
    if (!empty($excluded_categories)) {
      $blah = explode('and', $excluded_categories);
      foreach($blah as $category) {
       $category = intval($category);
       $sql_exclude_cats .= " AND post_category != $category";

    return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts WHERE post_date < '$current_post_date' AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1");

Note that an if (!is_single) conditional was included from the very start. There is no explanation in the code or Subversion logs why it is there, so we are left to assume it was arbitrary.

Surprisingly, a support ticket for this did not appear in the WP bug tracker until 3 months ago. Despite being a trivial fix, its addition into the main source tree has been marked as a low priority and won’t be included until version 3.0 (I guess because it breaks backward compatibility). No date has been set for the release of 3.0 yet, but at the time of this writing there were 379 open tickets — 86% of the total milestone.

It’s always frustrating to find bugs in software that you need fixed for a specific bit of functionality. It’s even more frustrating with open source software, because there is no veil to hide the project’s ugly warts. Everyone can see the important bugs that remain unfixed years after they have been reported. (I’m looking at you, Mozilla and Ubuntu.) Transparency is a double-edged sword.

In the meantime, if you need the functionality of “next” and “previous” links on your WordPress homepage, you can simply use the patch included in the support ticket. A single change inside the get_adjacent_post function in wp-includes/link-template.php will fix it:

function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $previous = true) {
    global $post, $wpdb;

    if ( empty($post) || is_attachment() )  // remove the !is_single()
        return null;


Leave a Reply

One Response to The Downside of Open Source: Transparency