Make WordPress Core

Ticket #51550: 51550.diff

File 51550.diff, 955 bytes (added by dlh, 4 years ago)
  • src/wp-includes/revision.php

    diff --git src/wp-includes/revision.php src/wp-includes/revision.php
    index 6fc288888d..038e12ff25 100644
    function wp_revisions_to_keep( $post ) { 
    564564         * @param int     $num  Number of revisions to store.
    565565         * @param WP_Post $post Post object.
    566566         */
    567         return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
     567        $num = apply_filters( 'wp_revisions_to_keep', $num, $post );
     568
     569        /**
     570         * Filters the number of revisions to save for the given post by its post type.
     571         *
     572         * Overrides the value of WP_POST_REVISIONS.
     573         *
     574         * The dynamic portion of the hook name, `$post->post_type`, refers to
     575         * the post type slug.
     576         *
     577         * @since 5.6.0
     578         *
     579         * @param int     $num  Number of revisions to store.
     580         * @param WP_Post $post Post object.
     581         */
     582        $num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post );
     583
     584        return (int) $num;
    568585}
    569586
    570587/**