Make WordPress Core


Ignore:
Timestamp:
10/06/2026 05:43:16 PM (6 weeks ago)
Author:
johnbillion
Message:

Security: Backport the WordPress 7.1.3 security fixes to the 4.9 branch.

  • REST API: Require both capabilities to change a post's sticky status.
  • Query: Prevent exposure of comments on unviewable posts.
  • Posts, Post Types: Fire dynamic status transition hooks only for registered statuses and post types.
  • Administration: Treat contextual help tab links as selectors.
  • Embeds: Remove support for Imgur oEmbeds.
  • HTTP: Improve relative path resolution in WP_Http::make_absolute_url().

Merges r64127, r64128, r64130, r64131, r64132, r64133 to the 4.9 branch.

Props xknown, jeremyfelt, jorbin, peterwilsoncc, ehtis, westonruter, lancewillett, jonsurrell, marcs0h, rfaile313, johnbillion, vortfu.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/class-wp-query.php

    r54569 r64181  
    28722872                }
    28732873
    2874                 if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
    2875                         /** This filter is documented in wp-includes/query.php */
    2876                         $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
    2877 
    2878                         /** This filter is documented in wp-includes/query.php */
    2879                         $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
    2880 
    2881                         /** This filter is documented in wp-includes/query.php */
    2882                         $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
    2883                         $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
    2884 
    2885                         /** This filter is documented in wp-includes/query.php */
    2886                         $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
    2887                         $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
    2888 
    2889                         /** This filter is documented in wp-includes/query.php */
    2890                         $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
    2891 
    2892                         $comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
    2893                         $comments = $wpdb->get_results($comments_request);
    2894                         // Convert to WP_Comment
    2895                         $this->comments = array_map( 'get_comment', $comments );
    2896                         $this->comment_count = count($this->comments);
    2897                 }
    2898 
    28992874                // Check post status to determine if post should be displayed.
    29002875                if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
    … …  
    29452920                }
    29462921
     2922                if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
     2923                        /** This filter is documented in wp-includes/query.php */
     2924                        $cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
     2925
     2926                        /** This filter is documented in wp-includes/query.php */
     2927                        $cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
     2928
     2929                        /** This filter is documented in wp-includes/query.php */
     2930                        $cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
     2931                        $cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
     2932
     2933                        /** This filter is documented in wp-includes/query.php */
     2934                        $corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
     2935                        $corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
     2936
     2937                        /** This filter is documented in wp-includes/query.php */
     2938                        $climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
     2939
     2940                        $comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
     2941                        $comments = $wpdb->get_results($comments_request);
     2942                        // Convert to WP_Comment
     2943                        $this->comments = array_map( 'get_comment', $comments );
     2944                        $this->comment_count = count($this->comments);
     2945                }
     2946
    29472947                // Put sticky posts at the top of the posts array
    29482948                $sticky_posts = get_option('sticky_posts');
Note: See TracChangeset for help on using the changeset viewer.