Forum: WP Users Geolocation

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support related to the WP Users Geolocation premium extension please open a new premium support ticket.

[Resolved]Can WP User Geolocation search according to wp profile role?

Forums WP Users Geolocation Can WP User Geolocation search according to wp profile role?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #31610

    Can I search users according to their wordpress role with WP Users Geolocation? For example I only want to show wp profiles that have the role of customers only or the role of vendors only.


    Hello Marcsarin,
    The feature is not available via UI but you can easily filter Search results ( of GEO my WP’s WP Users form ) based on user role using filters provided by the plugin.


    Thanks for the info. I bought the plugin. So how do I filter to show results for vendors role only?


    Thank you for the purchase Marcsarin.

    Add the code below to the functions.php file of your theme and modify it based on your needs ( the form ID and user role as noted in the script ):


    This topic marked “Resolved” due to inactivity. If you wish to reply to this topic please change its status to “Not resolved”  before replying.

    Phill Healey

    Sorry for tagging on to an existing thread….

    How can we use this code to exclude more than one user role?

    Phill Healey

    I actually meant to show more than one user role (eg show only ‘editor’ & ‘subscriber’ roles but exclude all others).


    I am attempting to achieve this on my site –
    Submit search result returns only members with role of ‘Vendor’
    At present all members that have added their address/location are returned in search results.

    before I add this code in functions.php can you please tell me
    1 – It looks like the code excludes user roles 10
    2 – Displays Editor only
    In the code
    //enable advanced query
    add_filter( ‘gmw_ug_advanced_query_class’, ‘__return_true’ );

    function gmw_exclude_users_by_role( $gmw ) {

    //use the filter only for a specific form. Change the value 1 to your form ID
    if ( $gmw[‘ID’] == 1 ) {
    //Filter results based on Editor role. Modify it based on your needs
    $gmw[‘query_args’][‘role’] = ‘Editor’;
    return $gmw;
    add_filter( ‘gmw_ug_form_before_users_query’, ‘gmw_exclude_users_by_role’, 10 );

    I am a bit confused over what this code displays/excludes, Could you please explain?


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

You must be logged in to reply to this topic.