From 8db393ada6bd2c33e65a71e06a21cac235741c7f Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 5 Feb 2016 18:58:25 +0000 Subject: [PATCH] Make the `$post` param optional in `get_post_field()`. When `$post` is `null`, the current post object will be returned. Props sebastian.pisula. Fixes #35683. Built from https://develop.svn.wordpress.org/trunk@36481 git-svn-id: http://core.svn.wordpress.org/trunk@36448 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index cccc5c0871..eaf6e09b37 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -494,16 +494,17 @@ function get_post_ancestors( $post ) { * supported values are found within those functions. * * @since 2.3.0 + * @since 4.5.0 The `$post` parameter was made optional. * * @see sanitize_post_field() * * @param string $field Post field name. - * @param int|WP_Post $post Post ID or post object. + * @param int|WP_Post $post Optional. Post ID or post object. Defaults to current post. * @param string $context Optional. How to filter the field. Accepts 'raw', 'edit', 'db', * or 'display'. Default 'display'. * @return string The value of the post field on success, empty string on failure. */ -function get_post_field( $field, $post, $context = 'display' ) { +function get_post_field( $field, $post = null, $context = 'display' ) { $post = get_post( $post ); if ( !$post ) diff --git a/wp-includes/version.php b/wp-includes/version.php index 2acde723cf..82e3c29c89 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36480'; +$wp_version = '4.5-alpha-36481'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.