Forums Forums Search & Filter Pro ACF, Post Meta, Relevanssi conflict

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #260220

    I was able to fix my issue. Here is my code snippet in case anyone runs into the same issue…

    function set_user_di( $query_args, $sfid ) {
      //if search form ID = 225, the do something with this query
      $nam_options = get_option( 'nam_options' );
      $inventory_form_id = (int)$nam_options['my_inventory_form_id_number'];
    
    	if ( is_user_logged_in() && $sfid==$inventory_form_id ) {
        if ($query_args['meta_query']) {
          array_push($query_args['meta_query'], array(
            'key' 		=> 'owner',
            'value'		=> get_current_user_id(),
            'compare' 	=> '=',
          ));
        } else {
          $meta_query = array(
            array(
              'key' 		=> 'owner',
              'value'		=> get_current_user_id(),
              'compare' 	=> '=',
            ),
          );
    
          $query_args = $meta_query;
        }
      }
    
    	return $query_args;
    }
    add_filter( 'sf_edit_query_args', 'set_user_di', 20, 2 );
    Trevor
    #260234

    Thanks for sharing. I will close this thread for now.

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