WordPress.org

Make WordPress Core

Ticket #40481: 40481-1.patch

File 40481-1.patch, 1.7 KB (added by philipjohn, 4 years ago)

Improves inline documentation by accounting for possible return values and expanding information on nature of array returned.

  • wp-includes/post.php

     
    28242824 *
    28252825 * @since 2.3.0
    28262826 *
    2827  * @param int   $post_id Optional. The Post ID. Does not default to the ID of the
    2828  *                       global $post. Default 0.
    2829  * @param array $args Optional. Overwrite the defaults
    2830  * @return array List of post tags.
     2827 * @param int    $post_id Optional. The Post ID. Does not default to the ID of the
     2828 *                        global $post. Default 0.
     2829 * @param array  $args    Optional. Overwrite the defaults
     2830 * @return array|WP_Error Array of WP_Term objects on success, an empty array if there are no
     2831 *                        terms, or a WP_Error object if the `post_tag` taxonomy does not exist.
    28312832 */
    28322833function wp_get_post_tags( $post_id = 0, $args = array() ) {
    28332834        return wp_get_post_terms( $post_id, 'post_tag', $args);
     
    28462847 *                         global $post. Default 0.
    28472848 * @param string $taxonomy Optional. The taxonomy for which to retrieve terms. Default 'post_tag'.
    28482849 * @param array  $args     Optional. wp_get_object_terms() arguments. Default empty array.
    2849  * @return array|WP_Error  List of post terms or empty array if no terms were found. WP_Error object
    2850  *                         if `$taxonomy` doesn't exist.
     2850 * @return array|WP_Error  Array of WP_Term objects on success or empty array if no terms were
     2851 *                         found. WP_Error object if `$taxonomy` doesn't exist.
    28512852 */
    28522853function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
    28532854        $post_id = (int) $post_id;