From d7599e834d681ec6cdfc48baa6ae9e93849541c7 Mon Sep 17 00:00:00 2001
From: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Date: Sat, 3 Mar 2018 19:31:00 -0600
Subject: [PATCH] Handle negative page indexes in get_the_content
---
wp-includes/post-template.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php
index 9bbfd764b0..35804c5c59 100644
|
a
|
b
|
function get_the_content( $more_link_text = null, $strip_teaser = false ) { |
| 292 | 292 | if ( $page > count( $pages ) ) { // if the requested page doesn't exist |
| 293 | 293 | $page = count( $pages ); // give them the highest numbered page that DOES exist |
| 294 | 294 | } |
| | 295 | else if ( $page < 1 ) { // or if the requested page was zero or not set |
| | 296 | $page = 1; // return the first page instead |
| | 297 | } |
| 295 | 298 | |
| 296 | 299 | $content = $pages[ $page - 1 ]; |
| 297 | 300 | if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { |