Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nikitasinelnikov/ac06eab52fba116ea9c81094d5a12544 to your computer and use it in GitHub Desktop.
Save nikitasinelnikov/ac06eab52fba116ea9c81094d5a12544 to your computer and use it in GitHub Desktop.
Fixed redirects issues
function um_custom_disable_redirect( $post_ID, $post_after, $post_before ) {
$post_obj = get_post( $post_ID );
if ( isset( $post_obj->post_type ) && 'um_activity' == $post_obj->post_type ) {
add_filter( 'wpseo_premium_post_redirect_slug_change', function( $bool ) {
return true;
}, 10, 1 );
}
}
add_action( 'post_updated', 'um_custom_disable_redirect', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment