As far as I understand, I can filter a view with custom PHP. (The existing filter options are not enough in my case.) I have found several articles that describe how this should work, but for me already the hook does not work. Maybe you can help me.
I have set up a test installation here hidden link.
On the home page, I added a view via shortcode [wpv-view name="list-posts"].
In the functions.php I try to use the hook "wpv_filter_query". I use the Query Monitor plugin to debug the code (QM::...).
While "a" is output in the log, the "post_type_filter_func" function does not seem to be triggered (query monitor message "b"). What am I doing wrong? Can you nudge me in the right direction?
Thank you for contacting us and I'd be happy to assist.
I tested the code that you shared on my test website and it worked as expected.
Then I also tested your website's homepage after clearing the view's cache from WP Admin -> Toolset -> Views and was able to see both errors in the log.
( screenshot: hidden link )