From 6c3b030245be0935342ffe33b6e47776093dd723 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Aug 2013 16:24:08 +0000 Subject: [PATCH] Avoid PHP notices in get_sample_permalink() and get_sample_permalink_html(). Remove unused global reference. props ocean90. fixes #25005. git-svn-id: https://develop.svn.wordpress.org/trunk@25028 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/post.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php index aecc433ce1..d78e7f2841 100644 --- a/src/wp-admin/includes/post.php +++ b/src/wp-admin/includes/post.php @@ -996,9 +996,9 @@ function postbox_classes( $id, $page ) { * @return array With two entries of type string */ function get_sample_permalink($id, $title = null, $name = null) { - $post = get_post($id); - if ( !$post->ID ) - return array('', ''); + $post = get_post( $id ); + if ( ! $post ) + return array( '', '' ); $ptype = get_post_type_object($post->post_type); @@ -1058,8 +1058,9 @@ function get_sample_permalink($id, $title = null, $name = null) { * @return string The HTML of the sample permalink slug editor. */ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { - global $wpdb; - $post = get_post($id); + $post = get_post( $id ); + if ( ! $post ) + return ''; list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);