WordPress.org

Making WordPress.org

Changeset 9642


Ignore:
Timestamp:
03/30/2020 12:57:58 AM (20 months ago)
Author:
dd32
Message:

Events API: Restrict events to a country when the location provided resolves to an entire country.

This fixes a search for Australia returning as a valid location, but showing US/JP/EU events rather than Australian events.

Fixes #5119.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/events/1.0/index.php

    r9640 r9642  
    162162        if ( ! empty( $location['country'] ) ) {
    163163            $event_args['country'] = $location['country'];
     164
     165            // If no specific location was found, but a country was, restrict to events from this country.
     166            if ( empty( $event_args['nearby'] ) ) {
     167                $event_args['restrict_by_country'] = true;
     168            }
    164169        }
    165170
Note: See TracChangeset for help on using the changeset viewer.