I don't want my player to slide on some walls (but still collide with them)

Godot Version

4.3

Question

Hello there!
I’m developing a 2D metroidvania so my character has skills like sliding on walls.
In certain parts of the map, though, there are some walls (specifically, diagonal or inclined walls) which I don’t want my character to slide on, although I want it to detect them and to stop moving.

I’m using the ray cast method:

if player.wall_ray_cast.is_colliding() and hold_direction_x:
		player.velocity.y += player.wall_sliding_vel

So, it might happen that the ray cast detects them and the character would slide on them if I jump, in a glitchy way.
How can I stop this from happening? How can I make an exception for specific walls?

Thanks to everyone who could help!
Have a great day!

Would that be possible to record a short video of this glitch to help us understand the issue?

Thanks for replying!
Here you go: wall-sliding-glitch

As you can see, the physics layer I set is inclined and the character detects it as a ground if he’s above, but in the edge of the corner below, he detects it as a wall and starts sliding.
I’d like to create an exception in those cases and making him physically fall automatically when landing on those type of walls.

EDIT: I re-uploaded the gif, couldn’t be seen.