Related listings only by same author

Hello, I try use this php snippet fot display related listings by same author only but it doesnt work. Pls help

add_action( 'hivepress/v1/models/listing/relate', function( $query, $listing ) { $query->filter( [ 'user' => $listing->get_user_id() ] ); }, 10, 2 );

by the way, i use hivepress geolocation plugin (mapbox) too (dont need similar listings by location radius)

Please try to debug this via var_dump, e.g. check the $query->get_args() after you change the query filter to check if the post_author parameter is changed. You can also adjust other parameters of the query and check if this affects the query, if not then it may be cache.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.