diff --git src/wp-includes/feed.php src/wp-includes/feed.php
index feb690d..ce5f045 100644
|
|
function get_the_content_feed($feed_type = null) { |
186 | 186 | $feed_type = get_default_feed(); |
187 | 187 | |
188 | 188 | /** This filter is documented in wp-includes/post-template.php */ |
189 | | $content = apply_filters( 'the_content', get_the_content() ); |
| 189 | $content = apply_filters( 'the_content', get_the_content( null, false, true ) ); |
190 | 190 | $content = str_replace(']]>', ']]>', $content); |
191 | 191 | /** |
192 | 192 | * Filter the post content for use in feeds. |
diff --git src/wp-includes/post-template.php src/wp-includes/post-template.php
index 4cc8573..9073d5c 100644
|
|
function get_the_guid( $post = 0 ) { |
223 | 223 | * Display the post content. |
224 | 224 | * |
225 | 225 | * @since 0.71 |
| 226 | * @since 4.5.0 Added the `$ignore_pagination` parameter. |
226 | 227 | * |
227 | | * @param string $more_link_text Optional. Content for when there is more text. |
228 | | * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. |
| 228 | * @param string $more_link_text Optional. Content for when there is more text. |
| 229 | * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. |
| 230 | * @param bool $ignore_pagination Optional. Return full text, ignoring pagination. Default is false. |
229 | 231 | */ |
230 | | function the_content( $more_link_text = null, $strip_teaser = false) { |
231 | | $content = get_the_content( $more_link_text, $strip_teaser ); |
| 232 | function the_content( $more_link_text = null, $strip_teaser = false, $ignore_pagination = false ) { |
| 233 | $content = get_the_content( $more_link_text, $strip_teaser, $ignore_pagination ); |
232 | 234 | |
233 | 235 | /** |
234 | 236 | * Filter the post content. |
… |
… |
function the_content( $more_link_text = null, $strip_teaser = false) { |
246 | 248 | * Retrieve the post content. |
247 | 249 | * |
248 | 250 | * @since 0.71 |
| 251 | * @since 4.5.0 Added the `$ignore_pagination` parameter. |
249 | 252 | * |
250 | 253 | * @global int $page |
251 | 254 | * @global int $more |
… |
… |
function the_content( $more_link_text = null, $strip_teaser = false) { |
253 | 256 | * @global array $pages |
254 | 257 | * @global int $multipage |
255 | 258 | * |
256 | | * @param string $more_link_text Optional. Content for when there is more text. |
257 | | * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. |
258 | | * @return string |
| 259 | * @param string $more_link_text Optional. Content for when there is more text. |
| 260 | * @param bool $strip_teaser Optional. Strip teaser content before the more text. Default is false. |
| 261 | * @param bool $ignore_pagination Optional. Return full text, ignoring pagination. Default is false. |
| 262 | * @return string The post content. |
259 | 263 | */ |
260 | | function get_the_content( $more_link_text = null, $strip_teaser = false ) { |
| 264 | function get_the_content( $more_link_text = null, $strip_teaser = false, $ignore_pagination = false ) { |
261 | 265 | global $page, $more, $preview, $pages, $multipage; |
262 | 266 | |
263 | 267 | $post = get_post(); |
… |
… |
function get_the_content( $more_link_text = null, $strip_teaser = false ) { |
275 | 279 | if ( $page > count( $pages ) ) // if the requested page doesn't exist |
276 | 280 | $page = count( $pages ); // give them the highest numbered page that DOES exist |
277 | 281 | |
278 | | $content = $pages[$page - 1]; |
| 282 | if ( $ignore_pagination ) { |
| 283 | $content = implode( "\n", $pages ); |
| 284 | } else { |
| 285 | $content = $pages[ $page - 1 ]; |
| 286 | } |
| 287 | |
279 | 288 | if ( preg_match( '/<!--more(.*?)?-->/', $content, $matches ) ) { |
280 | 289 | $content = explode( $matches[0], $content, 2 ); |
281 | 290 | if ( ! empty( $matches[1] ) && ! empty( $more_link_text ) ) |
diff --git tests/phpunit/tests/post/output.php tests/phpunit/tests/post/output.php
index 63b9aad..0aa533e 100644
|
|
EOF; |
214 | 214 | $post_id = self::factory()->post->create( array( 'post_excerpt' => 'Bar' ) ); |
215 | 215 | $this->assertSame( 'Bar', get_the_excerpt( $post_id ) ); |
216 | 216 | } |
| 217 | |
| 218 | /** |
| 219 | * @ticket 10984 |
| 220 | */ |
| 221 | function test_get_the_content_ignore_pagination() { |
| 222 | $post_id = self::factory()->post->create( array( |
| 223 | 'post_content' => 'Page 1 <!--nextpage--> Page 2 <!--nextpage--> Page 3', |
| 224 | ) ); |
| 225 | |
| 226 | $this->go_to( get_permalink( $post_id ) ); |
| 227 | $this->assertQueryTrue( 'is_singular', 'is_single' ); |
| 228 | setup_postdata( get_post( $post_id ) ); |
| 229 | |
| 230 | $this->assertEquals( 'Page 1 ', get_the_content() ); |
| 231 | $this->assertEquals( "Page 1 \n Page 2 \n Page 3", get_the_content( null, false, true ) ); |
| 232 | } |
217 | 233 | } |