Make WordPress Core


Ignore:
Timestamp:
11/15/2022 12:17:03 AM (13 months ago)
Author:
SergeyBiryukov
Message:

Docs: Correct type for the $post parameter of the {$adjacent}_post_link filter.

The parameter was documented as WP_Post, but it contains the value of get_adjacent_post(), which returns an empty string if there is no corresponding post, so the correct type is WP_Post|string.

Follow-up to [11243], [16951], [28111], [32606].

Props apermo, audrasjb.
Fixes #57047.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r54144 r54841  
    23192319     * @since 4.2.0 Added the `$adjacent` parameter.
    23202320     *
    2321      * @param string  $output   The adjacent post link.
    2322      * @param string  $format   Link anchor format.
    2323      * @param string  $link     Link permalink format.
    2324      * @param WP_Post $post     The adjacent post.
    2325      * @param string  $adjacent Whether the post is previous or next.
     2321     * @param string         $output   The adjacent post link.
     2322     * @param string         $format   Link anchor format.
     2323     * @param string         $link     Link permalink format.
     2324     * @param WP_Post|string $post     The adjacent post. Empty string if no corresponding post exists.
     2325     * @param string         $adjacent Whether the post is previous or next.
    23262326     */
    23272327    return apply_filters( "{$adjacent}_post_link", $output, $format, $link, $post, $adjacent );
Note: See TracChangeset for help on using the changeset viewer.