//=======================
// redirect_canonical()
//=======================
add_action( 'template_redirect', 'redirect_canonical' );
function redirect_canon() {
if ( is_single()) {
global $wp;
$wp->parse_request();
$current_url = trim( home_url( $wp->request ), "/" );
$redirect = get_permalink();
$surl = trim( $redirect, "/" );
if( $current_url != $surl ) {
wp_redirect( $redirect, 301 );
exit;
}
}
}
function done(cb) {
console.log("Finished");
cb();
}
gulp.task('default', gulp.series(gulp.parallel('a', 'b', 'c', 'd'), done));