/** * Redirect only the main WordPress REST API index * example.com/wp-json/ * * Other REST API endpoints remain functional. */ add_action( 'parse_request', function ( $wp ) { if ( ! isset( $wp->query_vars['rest_route'] ) ) { return; } $rest_route = untrailingslashit( (string) $wp->query_vars['rest_route'] ); // Redirect only the REST API root/index. if ( '' === $rest_route || '/' === $rest_route ) { wp_safe_redirect( home_url( '/' ), 302 ); exit; } }, 1 );
// width=
? Hi, Greetings from HELP. How can I help you?