diff --git a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/partials/sync-people.php b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/partials/sync-people.php index d1d63a8f7..b6fa2bac0 100644 --- a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/partials/sync-people.php +++ b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/admin/partials/sync-people.php @@ -145,18 +145,19 @@ function geocode_location( $id ) { $params['meta_input']['lf_person_website'] = $p->website; } - $pp = get_posts( - array( - 'post_type' => 'lf_person', - 'title' => $p->name, - 'post_status' => 'publish', - 'numberposts' => 1, - 'update_post_term_cache' => false, - 'update_post_meta_cache' => false, - 'orderby' => 'post_date ID', - 'order' => 'ASC', - ) + $args = array( + 'post_type' => 'lf_person', + 'title' => $p->name, + 'post_status' => 'publish', + 'numberposts' => 1, ); + + if ( $image_url ) { + $args['meta_value'] = $image_url; + } + + $pp = get_posts( $args ); + if ( ! empty( $pp ) ) { $params['ID'] = $pp[0]->ID; } @@ -204,6 +205,7 @@ function geocode_location( $id ) { array( 'post_type' => 'lf_person', 'post__not_in' => $synced_ids, + 'posts_per_page' => -1, ) ); while ( $query->have_posts() ) { @@ -212,4 +214,6 @@ function geocode_location( $id ) { } // clear the site cache. -pantheon_wp_clear_edge_all(); +if ( function_exists( 'pantheon_wp_clear_edge_all' ) ) { + pantheon_wp_clear_edge_all(); +} diff --git a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/includes/class-lf-mu.php b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/includes/class-lf-mu.php index d460c2998..8a2a347ed 100644 --- a/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/includes/class-lf-mu.php +++ b/web/wp-content/mu-plugins/wp-mu-plugins/lf-mu/includes/class-lf-mu.php @@ -204,7 +204,7 @@ private function define_admin_hooks() { // Example of how to run a sync locally on demand. // $this->loader->add_action( 'init', $plugin_admin, 'sync_kcds' ); //phpcs:ignore. - // $this->loader->add_action( 'init', $plugin_admin, 'sync_projects' ); //phpcs:ignore. + // $this->loader->add_action( 'init', $plugin_admin, 'sync_people' ); //phpcs:ignore. $this->loader->add_filter( 'dashboard_glance_items', $plugin_admin, 'custom_glance_items', 10, 1 );