WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 6 weeks ago

#35385 new enhancement

Able to get raw content by calling get_the_archive_description

Reported by: wido Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: has-patch has-unit-tests
Focuses: template Cc:
PR Number:

Description

Calling the get_the_archive_description the content will be passed to some filters by the sanitize_term_field function, one of them is wpautop.

To add some class to the p tag the only way is to perform a preg_replace but that can create issue with other callbacks hooked into 'get_the_archive_description'.

Would be great to have a param like $context as the get_term_field has to able to pass raw and retrieve only the text.

Attachments (3)

35385.diff (3.2 KB) - added by wido 6 weeks ago.
Introduce additional parameter to get the raw version of the post type archive description
35385-1.diff (3.2 KB) - added by wido 6 weeks ago.
Fix wrong generated diff from master
35385-2.diff (3.1 KB) - added by wido 6 weeks ago.
Change filter name and apply it only when the raw parameter is true.

Download all attachments as: .zip

Change History (7)

#1 @swissspidy
4 years ago

  • Component changed from General to Taxonomy
  • Focuses template added

#2 @chriscct7
4 years ago

  • Version trunk deleted

@wido
6 weeks ago

Introduce additional parameter to get the raw version of the post type archive description

#3 @wido
6 weeks ago

Instead of context I thought to introduce a boolean parameter which simply return the raw version of the description.
A filter has been added to be able to filter the description before it's returned.

I think a boolean introduce less complexity than a string since it's just a toggle action.

More over, I guess we could introduce a new function instead of passing a parameter, something like get_raw_post_type_archive_description which could be called by get_the_post_type_description, this way we do not introduce parameters making the function more clear and simple to call.

#4 @wido
6 weeks ago

  • Keywords has-patch has-unit-tests added

@wido
6 weeks ago

Fix wrong generated diff from master

@wido
6 weeks ago

Change filter name and apply it only when the raw parameter is true.

Note: See TracTickets for help on using tickets.