Opened 2 years ago
Closed 2 years ago
#17279 closed defect (bug) (fixed)
No need to run twentyeleven_url_grabber twice
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Themes | Version: | 3.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
Just run it once to get the result and if that's false then replace it with the permalink.
Related: #17267
Attachments (1)
Change History (5)
I initially did that but personally found it a bit harder to read, but achieves the same result.
comment:3
lancewillett — 2 years ago
Even better is to run it once and use get_permalink() only as a fallback. empty() catches the false and an empty string.
$link_url = twentyeleven_url_grabber(); if ( empty( $link_url ) ) $link_url = get_permalink();
comment:4
lancewillett — 2 years ago
- Owner set to lancewillett
- Resolution set to fixed
- Status changed from new to closed
In [17917]:
Note: See
TracTickets for help on using
tickets.

Always best to be explicit about it. I'd suggest this style instead:
if ( false == ( $link_url = twentyeleven_url_grabber() ) ) { $link_url = get_permalink(); }