Created
July 25, 2018 18:35
-
-
Save camaleaun/6b27ada6afc53213013780cfab6860d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'short_aliases' ); | |
add_filter( 'short_aliases', 'shorts_redirect' ) ); | |
function short_aliases() { | |
$aliases = apply_filters( 'short_aliases', array() ); | |
if ( ! is_array( $aliases ) ) { | |
$aliases = array(); | |
} | |
foreach ( $aliases as $alias => $redirects ) { | |
add_rewrite_rule( "^$alias/?", $redirects, 'top' ); | |
} | |
} | |
function shots_redirect( $redirects ) { | |
$short = get_query_var( 'short' ); | |
$redirects['slug'] = get_post_type_archive_link( 'page' ); | |
return $redirects; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment