Thank you for your help, Bart. I tried your suggestion, but I'm afraid I'm a little overwhelmed by the amount of debug info.

Here is the complete ~/.zshrc that I use to test this:

# =========================================

autoload -U compinit

cdpath=(. /tmp/opt)

compinit

zstyle ':completion:*' matcher-list 'm:{[:lower:]}={[:upper:]}' '+l:|=*'
zstyle ':completion::*:::' completer _expand _complete _prefix _approximate _ignored

zstyle ':completion:*:*:cd:*:*' completer _expand _complete _complete:withpath _prefix _approximate _ignored
zstyle ':completion:*:complete:cd:*:*' tag-order local-directories -
zstyle ':completion:*:withpath:cd:*:*' tag-order path-directories

zstyle ':completion:*:*:cd:*:*' ignore-parents parent pwd

mkdir -p /tmp/{zaa,zbb,zcc,stats,opt}
mkdir -p /tmp/stats/{stats-lib,stats-web}
mkdir -p /tmp/opt/webcert

# =========================================

I then go to '/tmp/zaa' and write 'cd ../z<tab>'. The result is that 'zaa', 'zbb' and 'zcc' are all offered as alternatives, although I want 'zaa' to be filtered out.

If I remove the trailing hyphen on this line: 'zstyle ':completion:*:complete:cd:*:*' tag-order local-directories -', the ignore-parents style works: only 'zbb' and 'zcc' are offered when doing 'cd ../z<tab>' from '/tmp/zaa'. But without the hyphen, the problem that I was originally trying to solve is still there. I.e. if I go to '/tmp/stats' and type 'cd web<tab>', I am offered 'webcert', although I want to be offered 'stats-web'.

I attach the debug logs from the two different versions, 'file-1.txt' is the run _without_ hyphen, where 'zaa' is not offered. 'file-2.txt' is the run _with_ hyphen, where 'zaa' is offered despite the ignore-parents style.