WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9677 closed defect (bug) (worksforme)

Quick edit of pages strips page code content

Reported by: apeatling Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7.1
Component: Administration Keywords: needs-patch
Focuses: Cc:

Description

Using WordPress MU 2.7.1 (same codebase as WordPress 2.7.1 in this part)

I'm creating the BuddyPress codex documentation, which includes code snippets. I've turned off the visual editor as it doesn't handle code snippets very well.

Everything works well, and the code displays correctly when saved.

However, if I use the "Quick Edit" option for that page (I changed the slug) then save, all the code snippet content on the page is stripped completely. I'm assuming this would probably be the same for a post.

Here are the steps:

  1. Create a page with the visual editor turned off.
  2. Add some example code to that page, wrapped in the <?php ?> tags.
  3. Save the page, WordPress will convert the code so it uses HTML entities.
  4. View the page, it should display the code just fine on the page within the theme.
  5. Go to the edit pages screen and hit the "Quick Edit" link for the page.
  6. Change the slug and hit the "Update Page" button.
  7. View the page again, the code is now stripped.

Change History (7)

comment:1 apeatling5 years ago

Ugh... Trac formatting.

  1. Create a page with the visual editor turned off.
  1. Add some example code to that page, wrapped in the <?php ?> tags.
  1. Save the page, WordPress will convert the code so it uses HTML entities.
  1. View the page, it should display the code just fine on the page within the theme.
  1. Go to the edit pages screen and hit the "Quick Edit" link for the page.
  1. Change the slug and hit the "Update Page" button.
  1. View the page again, the code is now stripped.

comment:2 apeatling5 years ago

Page revision previews are also stripping the code, even though it is converted to HTML entities. So now I can't get it back. :(

comment:3 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; pages quick edit removed
  • Milestone changed from Unassigned to Future Release
  • Version set to 2.7.1

comment:4 azaozz5 years ago

Cannot reproduce in trunk. QE doesn't load the post/page content, it's only passed along internally in php (there may be some extra filters in MU).

comment:5 azaozz5 years ago

Also you cannot enter code directly in a textarea, the html special chars have to be entered as entities there when you need to display them.

comment:6 hakre5 years ago

Well, tested that. For me (2.8 trunk) entering works as long as you do not switch to the visual tab. Looks like the javascript code is already removing it while switching fomr HTML -> Visual.

my test page content (HTML):

Heya, I love that!

<code>Testcode.</code>

<code>Extended Testcode.</code>

<code><?php echo('Test'); ?></code>

With Javascript switched of, the data keeps untained, here is the output within the default theme:

<p><code>Testcode.</code></p>
<p><code>Extended Testcode.</code></p>
<p><code><?php echo('Test'); ?></code></p>

comment:7 Denis-de-Bernardy5 years ago

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

works for me too. please re-open with feedback.

Note: See TracTickets for help on using tickets.