diff options
author | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2025-04-12 22:40:17 +0000 |
---|---|---|
committer | Sergey Biryukov <sergeybiryukov@git.wordpress.org> | 2025-04-12 22:40:17 +0000 |
commit | d664c3c8f48ed379f8a9720a7d74d518fe3f8100 (patch) | |
tree | fd2374fbfdc583ec79741c78c3144a3b1267eca9 | |
parent | 4ce25a5b915ce4409fb6339b8b1ce46fc10aeb0a (diff) | |
download | wordpress-d664c3c8f48ed379f8a9720a7d74d518fe3f8100.tar.gz wordpress-d664c3c8f48ed379f8a9720a7d74d518fe3f8100.zip |
Coding Standards: Correct `$post` parameter default values in `link-template.php`.
This commit corrects the default post ID parameter values used in several functions to bring them in line with their `int` doctypes (and the doctypes of their internal function calls).
More specifically,
* `get_page_link()`: `$post = false` changed to `$post = 0`
* `_get_page_link()`: `$post = false` changed to `$post = 0`
* `post_comments_feed_link()`: `$post_id = ''` changed to `$post_id = 0`
Follow-up to [1752], [4475], [6365], [9136], [9274], [21735], [24490], [32606], [37252].
Props justlevine.
See #63268.
git-svn-id: https://develop.svn.wordpress.org/trunk@60152 602fd350-edb4-49c9-b593-d223f7449a82
-rw-r--r-- | src/wp-includes/link-template.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index e96c2d1378..3e02c17853 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -388,7 +388,7 @@ function get_post_permalink( $post = 0, $leavename = false, $sample = false ) { * Default false. * @return string The page permalink. */ -function get_page_link( $post = false, $leavename = false, $sample = false ) { +function get_page_link( $post = 0, $leavename = false, $sample = false ) { $post = get_post( $post ); if ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID ) { @@ -425,7 +425,7 @@ function get_page_link( $post = false, $leavename = false, $sample = false ) { * Default false. * @return string The page permalink. */ -function _get_page_link( $post = false, $leavename = false, $sample = false ) { +function _get_page_link( $post = 0, $leavename = false, $sample = false ) { global $wp_rewrite; $post = get_post( $post ); @@ -834,7 +834,7 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) { * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. * Default is the value of get_default_feed(). */ -function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) { +function post_comments_feed_link( $link_text = '', $post_id = 0, $feed = '' ) { $url = get_post_comments_feed_link( $post_id, $feed ); if ( empty( $link_text ) ) { $link_text = __( 'Comments Feed' ); |