WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

Last modified 3 months ago

#46958 closed defect (bug) (fixed)

Which of 'privacypolicy' or 'privacy_policy' is valid for get_query_template function?

Reported by: tmatsuur Owned by: SergeyBiryukov
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.2
Component: Privacy Keywords:
Focuses: template Cc:

Description

Currently, 'privacy_policy' is used in the get_privacy_policy_template function.

return get_query_template( 'privacy_policy', $templates );

In contrast, the docs contains a 'privacypolicy' without the hyphen.

Is the content of docs wrong?

Change History (6)

#1 @tmatsuur
3 months ago

It was an underscore, not a hyphen.

#2 follow-up: @johnbillion
3 months ago

  • Component changed from General to Privacy
  • Focuses template added
  • Milestone changed from Awaiting Review to 5.2

This sounds like the same problem that happens with front_page.

#3 in reply to: ↑ 2 @tmatsuur
3 months ago

Replying to johnbillion:

This sounds like the same problem that happens with front_page.

Thank you @johnbillion.

#4 @johnbillion
3 months ago

This template was introduced in #44005.

Related issue for the underscore being stripped out: #21213.

Let's standardise on using either privacypolicy or privacy.

#5 @SergeyBiryukov
3 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 45231:

Themes: Standardize on passing frontpage and privacypolicy as the $type parameter to get_query_template().

These keys are used in {$type}_template_hierarchy and {$type}_template filters.

Previously, front_page and privacy_policy were passed, but get_query_template() stripped the underscores before passing the values to the filters.

Props rinatkhaziev, tmatsuur, johnbillion.
Fixes #21213, #46958.

#6 @garrett-eclipse
3 months ago

Thanks for catching this @tmatsuur and identifying the issue @johnbillion I'd copied the front_page implementation for #44005 and overlooked there was a pre-existing issue with that.
I appreciate the quick turnaround and patch @SergeyBiryukov
All the best

Note: See TracTickets for help on using tickets.