* or query in an attempt to figure the correct page to go to.
*
* @since 2.3.0
- * @uses $wp_rewrite
- * @uses $is_IIS
+ *
+ * @global WP_Rewrite $wp_rewrite
+ * @global bool $is_IIS
+ * @global WP_Query $wp_query
+ * @global wpdb $wpdb
*
* @param string $requested_url Optional. The URL that was requested, used to
* figure if redirect is needed.
* @param bool $do_redirect Optional. Redirect to the new URL.
- * @return null|false|string Null, if redirect not needed. False, if redirect
- * not needed or the string of the URL
+ * @return string|void The string of the URL, if redirect needed.
*/
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
$redirect_url .= '?' . $redirect['query'];
}
- if ( !$redirect_url || $redirect_url == $requested_url )
- return false;
+ if ( ! $redirect_url || $redirect_url == $requested_url ) {
+ return;
+ }
// Hex encoded octets are case-insensitive.
if ( false !== strpos($requested_url, '%') ) {
*/
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
- if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
- return false;
+ // yes, again -- in case the filter aborted the request
+ if ( ! $redirect_url || $redirect_url == $requested_url ) {
+ return;
+ }
if ( $do_redirect ) {
// protect against chained redirects
} else {
// Debug
// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
- return false;
+ return;
}
} else {
return $redirect_url;
* @since 2.3.0
*
* @global wpdb $wpdb WordPress database abstraction object.
+ * @global WP_Rewrite $wp_rewrite
*
- * @return bool|string The correct URL if one is found. False on failure.
+ * @return false|string The correct URL if one is found. False on failure.
*/
function redirect_guess_404_permalink() {
global $wpdb, $wp_rewrite;
return false;
}
+/**
+ *
+ * @global WP_Rewrite $wp_rewrite
+ */
function wp_redirect_admin_locations() {
global $wp_rewrite;
if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) )