WordPress.org

Make WordPress Core

Ticket #33372: WP_Query_returns_404_when_negative_p_parameter.33372.diff

File WP_Query_returns_404_when_negative_p_parameter.33372.diff, 509 bytes (added by Akeif, 4 years ago)
  • src/wp-includes/query.php

    diff --git src/wp-includes/query.php src/wp-includes/query.php
    index 38a6928..cfdf013 100644
    class WP_Query { 
    15951595                if ( ! empty($qv['robots']) )
    15961596                        $this->is_robots = true;
    15971597
    1598                 $qv['p'] =  absint($qv['p']);
     1598                $qv['p'] = intval( $qv['p'] );
     1599                if ( $qv['p'] < 0 ) {
     1600                        $qv['error'] = '404';
     1601                }
    15991602                $qv['page_id'] =  absint($qv['page_id']);
    16001603                $qv['year'] = absint($qv['year']);
    16011604                $qv['monthnum'] = absint($qv['monthnum']);