By: Bob Webb | Asked: 03/14/2024
Bob Webb asked 3 months ago
I'm trying to use frm_where_filter but it doesn't seem to be firing. Should it be firing on a view with filters set up using [get param] ?
1 Answers
Victor Font answered 3 months ago
What make you think the filter isn't firing? How are you testing the code? Are you setting a break point to halt execution?
Bob Webb replied 3 months ago

I used WP Hooks Finder and there was no sign of it and my function isn't doing what I expected and it doesn't seem to be the code that's wrong.
Good to know it should be firing so I'll carry on trying though.

Victor Font replied 3 months ago

This conversation was closed a little prematurely. I never heard of WP Hooks Finder and don't know how it works. I use a different debugging method, one that allows me to set breakpoints in code. Breakpoints halt code execution at specific places set be you so you can examine values and logic to make sure everything works as expected.

The first thing I would do is install the Kint debugger. It's an easy debugger to learn. There are only 2 commands to remember d() and ddd(). The first command displays the content its target parameter and continues execution. ddd() does the same display but halts execution.

If you followed the frm_where_filter example in the knowledge base, then your callback function is receiving 2 parameters, $where and $args.

To know if your code is being called with Kint, immediately after the function declaration display these two parameters. Your code will look like this:

function my_callback_function( $where, $args) {


The rest of your function follows this. but will not execute because of the ddd(). If this hook is firing for you, you will see two drop down lists that display every data element in both parameters. This is how you know the hook is firing. You can also test boolean logic and equations with Kint.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community