$item ) { if ( $item['slug'] === $slug && $i !== $index ) { $taken = true; } } if ( '' === $slug || '' === $url ) { $error = 'A slug and a full destination URL starting with http:// or https:// are required.'; } elseif ( $taken ) { $error = 'That slug is already used by another go link.'; } elseif ( null !== $index && isset( $redirects[ $index ] ) ) { // Keep the click history when the slug changes. if ( $redirects[ $index ]['slug'] !== $slug ) { $wpdb->query( $wpdb->prepare( "UPDATE $clicks SET slug = %s WHERE slug = %s", $slug, $redirects[ $index ]['slug'] ) ); } $redirects[ $index ] = array( 'slug' => $slug, 'url' => $url ); update_option( 'footloom_redirects', $redirects ); } else { $redirects[] = array( 'slug' => $slug, 'url' => $url ); update_option( 'footloom_redirects', $redirects ); } } elseif ( 'delete_redirect' === $action && isset( $redirects[ $index ] ) ) { $wpdb->query( $wpdb->prepare( "DELETE FROM $clicks WHERE slug = %s", $redirects[ $index ]['slug'] ) ); unset( $redirects[ $index ] ); $redirects = array_values( $redirects ); update_option( 'footloom_redirects', $redirects ); } elseif ( 'save_prefix' === $action ) { $prefix = trim( preg_replace( '/[^a-z0-9_\/-]/', '', strtolower( sanitize_text_field( wp_unslash( $_POST['prefix'] ?? '' ) ) ) ), '/' ); if ( '' === $prefix || preg_match( '#^wp-|//#', $prefix ) ) { $error = 'Choose a prefix with letters, numbers, dashes or underscores, like go or out. It can\'t start with wp-.'; } else { update_option( 'footloom_redirect_prefix', $prefix ); } } if ( $error ) { echo '
' . esc_html( $error ) . '
Saved.
Share a go link on your site, in emails, social posts or ads. Footloom counts each click and sends the visitor on to the destination right away.
No go links yet. Add your first one below.
| Go link | Destination | Last 7 days | All time | |
|---|---|---|---|---|
|
week : 0; ?> | total : 0; ?> | Edit |