WordPress Single Custom Post Type Permalinks Broken After 3.7.1 Update

After updating WordPress to 3.7.1, my single custom post type posts have stopped displaying content unless I’m using the default permalink structure. I’m not getting a 404 error, just an absence of post content. I’ve searched for solutions but nothing I’ve found so far describes exactly what I’m experiencing and no solutions have worked yet.

Here is my custom post type registration code from my theme’s functions.php:

add_action( 'init', 'gallery_init' );
add_action('init', 'my_custom_init');
function my_custom_init()
{
$labels = array(
'name' => _x('Work', 'post type general name'),
'singular_name' => _x('Work', 'post type singular name'),
'add_new' => _x('Add New', 'work'),
'add_new_item' => __('Add New Work'),
'edit_item' => __('Edit Work'),
'new_item' => __('New Work'),
'view_item' => __('View Work'),
'search_items' => __('Search Work'),
'not_found' =>  __('No work found'),
'not_found_in_trash' => __('No work found in Trash'),
'parent_item_colon' => ''
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'description' => __( 'Work for portfolio.' ),
'show_ui' => true,
'query_var' => '0',
'rewrite' => true,
'slug' => 'work',
'capability_type' => 'post',
'hierarchical' => true,
'menu_position' => null,
'exclude_from_search' => false,
'taxonomies' => array( 'gallery'),
'supports' => array('title','editor','thumbnail','custom-fields','page-attributes')
);
register_post_type('work',$args);
}

Related posts

Leave a Reply

1 comment

  1. In your $args array, you’ve got 'query_var' => '0'.

    Reading the register_post_type() docs, I see:

    query_var
    (boolean or string) (optional) Sets the query_var key for this post type.
    Default: true – set to $post_type

    I wonder if there’s a stricter check on the query_var in 3.7.1, where '0' doesn’t work as you might expect, since it’s not the same, strictly speaking, as (boolean) false. (Technically, as you’ve defined it, it’s a string.)