Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

A more concise name for the filter. Also, we don't need a conditional…

… check because if false or an empty array is returned the foreach loop won't execute

See #26
  • Loading branch information...
commit 78df039dfd576db239f10323e96fc5b0856301ad 1 parent 61bd24d
@danielbachhuber danielbachhuber authored
Showing with 2 additions and 3 deletions.
  1. +2 −3 safe-redirect-manager.php
View
5 safe-redirect-manager.php
@@ -708,10 +708,9 @@ public function action_parse_request() {
}
// Allow redirects to be filtered
- if ( ! $redirects = apply_filters( 'srm_filter_redirects_before_running', $redirects, $requested_path ) )
- return;
+ $redirects = apply_filters( 'srm_registered_redirects', $redirects, $requested_path );
- foreach ( $redirects as $redirect ) {
+ foreach ( (array)$redirects as $redirect ) {
$redirect_from = untrailingslashit( $redirect['redirect_from'] );
if ( empty( $redirect_from ) )

3 comments on commit 78df039

@jtsternberg

Nice! so dumb question, but type-casting the variable in the foreach loop will address the debug issue that occurs when the variable is empty?

@danielbachhuber

Yep. If the variable is false, it will be typecast to an empty array.

@jtsternberg

New trick for me. :+1:

Please sign in to comment.
Something went wrong with that request. Please try again.