-
+
+
+
+
/>
@@ -1384,7 +1495,7 @@
link_rating ) && $link->link_rating == $rating ) {
+ if ( isset( $link->link_rating ) && $link->link_rating === $rating ) {
echo ' selected="selected"';
}
echo '>' . $rating . '';
@@ -1459,13 +1570,13 @@
$publish_callback_args = array( '__back_compat_meta_box' => true );
if ( post_type_supports( $post_type, 'revisions' ) && 'auto-draft' !== $post->post_status ) {
- $revisions = wp_get_post_revisions( $post->ID, array( 'fields' => 'ids' ) );
+ $revisions = wp_get_latest_revision_id_and_total_count( $post->ID );
// We should aim to show the revisions meta box only when there are revisions.
- if ( count( $revisions ) > 1 ) {
+ if ( ! is_wp_error( $revisions ) && $revisions['count'] > 1 ) {
$publish_callback_args = array(
- 'revisions_count' => count( $revisions ),
- 'revision_id' => reset( $revisions ),
+ 'revisions_count' => $revisions['count'],
+ 'revision_id' => $revisions['latest_id'],
'__back_compat_meta_box' => true,
);
@@ -1560,21 +1671,27 @@
*/
do_action_deprecated( 'dbx_post_advanced', array( $post ), '3.7.0', 'add_meta_boxes' );
- // Allow the Discussion meta box to show up if the post type supports comments,
- // or if comments or pings are open.
+ /*
+ * Allow the Discussion meta box to show up if the post type supports comments,
+ * or if comments or pings are open.
+ */
if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
}
- $stati = get_post_stati( array( 'public' => true ) );
- if ( empty( $stati ) ) {
- $stati = array( 'publish' );
+ $statuses = get_post_stati( array( 'public' => true ) );
+
+ if ( empty( $statuses ) ) {
+ $statuses = array( 'publish' );
}
- $stati[] = 'private';
+
+ $statuses[] = 'private';
- if ( in_array( get_post_status( $post ), $stati, true ) ) {
- // If the post type support comments, or the post has comments,
- // allow the Comments meta box.
+ if ( in_array( get_post_status( $post ), $statuses, true ) ) {
+ /*
+ * If the post type support comments, or the post has comments,
+ * allow the Comments meta box.
+ */
if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core', array( '__back_compat_meta_box' => true ) );
}