Make WordPress Core

Opened 7 years ago

Closed 2 weeks ago

#46288 closed defect (bug) (worksforme)

'get_extended' breaks when using 'more' gutenberg block

Reported by: joewebber's profile joewebber Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description

'get_extended' returns the closing tag <!-- /wp:more -->' in the extended content, which prevents 'the_content' filter from working correctly.

Steps to replicate:

<?php
// Fetch post content
$content = get_post_field('post_content', get_the_ID());

// Get content parts
$content_parts = get_extended($content);

echo apply_filters('the_content', $content_parts['extended']);

Quick workaround (wp-includes/post.php line: 592):

<?php
$post = str_replace('<!-- /wp:more -->', '<!-- /more -->', $post);

Change History (3)

#1 @pento
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 5.0.3 to 5.0

Related: #46471.

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


2 weeks ago

#3 @SirLouen
2 weeks ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Reproduction Report

Description

❌ This report can't validate that the issue can be reproduced.

Environment

  • WordPress: 6.9-beta2-61080
  • PHP: 8.2.29
  • Server: nginx/1.29.3
  • Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 141.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty 2.9
  • MU Plugins:
    • WooCommerce Analytics - Proxy Speed Module 1.0.0
  • Plugins:
    • Classic Editor 1.6.7
    • Test Reports 1.2.0

Testing Instructins

  1. Added the code to singular.php template.
  2. Switched to Classic Editor
  3. Created a new post with content
  4. Added a <!--more--> in the middle of the content
  5. 👌 Extended section is rendering in the page template as expected
  1. Switched back to Gutenberg
  2. Converted text into blocks, including the more tags.
  3. 👌 Again, extended section is rendering in the page template as expected

Actual Results

  1. ❌ Error condition is not occurring.

Additional Notes

  • It seems that this issue is not reproducible anymore. I'm not sure how this was being generated in gutenberg back in the day, but the current, processes a regular more tag within two wp:more` tags like
<!-- wp:more -->
<!--more-->
<!-- /wp:more -->

I'm not sure if this has influenced in the current valid result, but probably. Closing this as worksforme

Note: See TracTickets for help on using tickets.