Is using a low F-number (wide aperture) for landscape photography a good practice?

I recently asked a question (How to increase the quality of photos taken through a DSLR?) on how to increase the sharpness of my images.

One of the answers proposed that even though it is known that for landscapes, in order to have a clear picture, it is recommended to use an aperture like f/10 or f/12, I can use f/2.8 or f/5.6 depending on my lenses.

Is this true? If yes, why does this happen and at what situations can it be applied?

I know that we can use the f/2.8 in landscape astrophotography, in order to gather as much light as possible.

The answers I am referring to is this one by xiota:

Your first image was shot at F10. The high F-number (smaller aperture)
produces deeper depth of field at the expense of more visible
diffraction. The DOF makes more of the image look in focus, but the
diffraction sacrifices fine detail. For crop sensor, F5.6 is a good
place to start. Adjust up or down as desired.

and this one by Jonas:

It is often said that the lower the zoom range of a lens, the sharper
it is. Maybe try to get a "cheap" (compared to other camera lenses)
prime lens (which means that the lens does not zoom; its focal length
is fixed) such as a 35mm f/1.8. Then stop down this lens to, let’s say
f/2.8, and your images will be very sharp.