Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 17554)
+++ wp-includes/link-template.php	(working copy)
@@ -2379,7 +2379,7 @@
 
 	global $wp_query;
 	$post_id = 0;
-	if ( 'query' == $context && is_single() ) {
+	if ( 'query' == $context && is_singular() ) { 
 		$post_id = $wp_query->get_queried_object_id();
 	} elseif ( 'post' == $context ) {
 		$post = get_post($id);
@@ -2388,11 +2388,15 @@
 
 	$shortlink = '';
 
-	// Return p= link for posts.
+	// Return p= link for all public post types.
 	if ( !empty($post_id) && '' != get_option('permalink_structure') ) {
-		$post = get_post($post_id);
-		if ( isset($post->post_type) && 'post' == $post->post_type )
-			$shortlink = home_url('?p=' . $post->ID);
+		if (!isset($post)) {
+			$post = get_post($post_id);
+		}
+		$post_type = get_post_type_object( $post->post_type );
+		if ( $post_type->public ) {
+			$shortlink = home_url('?p=' . $post_id);
+		}
 	}
 
 	return apply_filters('get_shortlink', $shortlink, $id, $context, $allow_slugs);
