Relocate isset check. Props TobiasBg, SergeyBiryukov. fixes #15041

git-svn-id: http://svn.automattic.com/wordpress/trunk@17076 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-20 11:41:08 +00:00
parent 708153f294
commit cb88352144

View File

@ -185,11 +185,11 @@ function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
$slug = $post->post_name; $slug = $post->post_name;
$draft_or_pending = in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) ); $draft_or_pending = isset($post->post_status) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
$post_type = get_post_type_object($post->post_type); $post_type = get_post_type_object($post->post_type);
if ( !empty($post_link) && ( ( isset($post->post_status) && !$draft_or_pending ) || $sample ) ) { if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {
if ( ! $leavename ) { if ( ! $leavename ) {
if ( $post_type->hierarchical ) if ( $post_type->hierarchical )
$slug = get_page_uri($id); $slug = get_page_uri($id);