WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#19941 closed enhancement (fixed)

Post template: return string instead of setting then return

Reported by: niallkennedy Owned by: nacin
Milestone: 3.4 Priority: normal
Severity: normal Version:
Component: Performance Keywords: has-patch
Focuses: Cc:

Description

In post template if a password is required to access the post a variable is currently set and the variable returned in the next line.

Return the result of get_the_password_form() instead of writing to a variable and immediately returning that variable.

Attachments (1)

post-template.diff (643 bytes) - added by niallkennedy 2 years ago.
return result of password form

Download all attachments as: .zip

Change History (5)

niallkennedy2 years ago

return result of password form

comment:1 nacin2 years ago

I wouldn't really call it "performance" but it is indeed good practice to not create a variable you only use once.

comment:2 niallkennedy2 years ago

  • Summary changed from Post template perf: return string instead of setting then return to Post template: return string instead of setting then return

comment:3 nacin2 years ago

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

In [19812]:

Don't create a variable we only use once. props niallkennedy, fixes #19941.

comment:4 ocean902 years ago

  • Milestone changed from Awaiting Review to 3.4
Note: See TracTickets for help on using tickets.