Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy filter from WooCommerce Feature class #3230

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adjust feedback
  • Loading branch information
burhandodhy committed Jan 17, 2023
commit 11bb1ff6247ebfade283ed223af5905e0f09bfd8
32 changes: 3 additions & 29 deletions includes/classes/Feature/WooCommerce/WooCommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,8 @@ public function whitelist_meta_keys( $meta, $post ) {
* @return array
*/
public function convert_post_object_to_id( $posts ) {
$new_posts = [];

foreach ( $posts as $post ) {
if ( is_object( $post ) ) {
$new_posts[] = $post->ID;
} else {
$new_posts[] = $post;
}
}

return $new_posts;
_doing_it_wrong( __METHOD__, 'This filter is removed from WooCommerce and will be removed from ElasticPress in a future release.', '4.5' );
return $posts;
}

/**
Expand Down Expand Up @@ -210,26 +201,9 @@ public function whitelist_taxonomies( $taxonomies, $post ) {
* @return array
*/
public function disallow_duplicated_query( $value, $query ) {
global $pagenow;

$searchable_post_types = $this->get_admin_searchable_post_types();

/**
* Make sure we're on edit.php in admin dashboard.
*/
if ( 'edit.php' !== $pagenow || ! is_admin() || ! in_array( $query->get( 'post_type' ), $searchable_post_types, true ) ) {
return $value;
}

/**
* Check if EP API request was already done. If request was sent return its results.
*/
if ( isset( $query->elasticsearch_success ) && $query->elasticsearch_success ) {
return $query->posts;
}
_doing_it_wrong( __METHOD__, 'This filter is removed from WooCommerce and will be removed from ElasticPress in a future release.', '4.5' );

return $value;

}

/**
Expand Down