• Resolved niemand_0

    (@niemand_0)


    I’m attempting to use the ‘relevanssi_post_ok’ filter. According to the documentation, there should be two arguments available: $post_ok and $post_ID. $post_ID is returning NULL for me. How do I get information about the current post being filtered so I can exclude it from the search results if I need to?

    add_filter('relevanssi_post_ok', 'filter_search_results');
    function filter_search_results($post_ok, $post_ID) {
    	var_dump($post_ID); // returns NULL
    	return $post_ok;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mikko Saari

    (@msaari)

    When a filter uses more than one parameter, you need to specify that:

    add_filter('relevanssi_post_ok', 'filter_search_results', 10, 2);

    Thread Starter niemand_0

    (@niemand_0)

    Thank you! I knew it was probably me doing something funky.

    Much appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘‘relevanssi_post_ok’ $post_ID returns NULL’ is closed to new replies.