WordPress.org

Make WordPress Core

Ticket #45329: 45329.diff

File 45329.diff, 897 bytes (added by manzoorwani.jk, 11 months ago)
  • src/wp-includes/link-template.php

     
    257257 * @param int|WP_Post $id        Optional. Post ID or post object. Default is the global `$post`.
    258258 * @param bool        $leavename Optional, defaults to false. Whether to keep post name. Default false.
    259259 * @param bool        $sample    Optional, defaults to false. Is it a sample permalink. Default false.
    260  * @return string|WP_Error The post permalink.
     260 * @return string|null The post permalink.
    261261 */
    262262function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {
    263263        global $wp_rewrite;
     
    264264
    265265        $post = get_post( $id );
    266266
    267         if ( is_wp_error( $post ) ) {
     267        if ( ! ( $post instanceof WP_Post ) ) {
    268268                return $post;
    269269        }
    270270