Make WordPress Core

Opened 8 years ago

Last modified 5 years ago

#39863 assigned enhancement

HTML description property of term in WP_REST_Terms_Controller lacks display filters

Reported by: davecpage's profile davecpage Owned by: joehoyle's profile joehoyle
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: REST API Keywords:
Focuses: Cc:

Description

Working with the REST API i've noticed that with terms, either from custom taxonomies or default categories and tags, their descriptions are different within REST requests compared to outputting within a theme template.

Tracking it down and I've noticed that within themes these term descriptions are having term_description filters applied, whereas within WP_REST_Terms_Controller the term description is used as is from the database.

At its most basic example a user can add HTML to a term description (either manually or via a plugin that adds a visual editor), and paragraphs will be applied for a theme, but not for the REST requests.

But the schema for Terms says that it's the HTML description of the term, which IMO is slightly wrong without all the term description filters.

Comparing to the WP_REST_Posts_Controller it further raises the question, should the Term controller be providing a raw and rendered version of the term description to match Post content? Or should the filters simply be added as it's a smaller change?

Change History (5)

#1 @joehoyle
8 years ago

  • Owner set to joehoyle
  • Status changed from new to assigned

Hmm well spotted. I don't think applying the filter on the current field would make sense as we run into the lossy issue of pushing the rendered value back to the DB.

I think to be backwards compatible we'd need to add a new field description_rendered which I'm not wild about. I'm interested in what @rmccue thinks here. I think we need to define a general precedent (which maybe we already have that I'm not aware of!) as this kind of problem could crop up again.

#2 @jnylen0
8 years ago

Ideally the term description should have raw and rendered properties, see #38679 for a similar change that we made before 4.7.

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


5 years ago

#4 @TimothyBlynJacobs
5 years ago

  • Type changed from defect (bug) to enhancement

How terrible an idea would be not applying the filter when in an edit context?

This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.