Skip to content

Commit

Permalink
Make sure REST requests return downloads in current language only
Browse files Browse the repository at this point in the history
  • Loading branch information
dgwatkins committed Sep 22, 2023
1 parent 4bc84d0 commit 577afce
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions class-edd-multilingual.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public function init_hooks() {

// Support for 'Checkout Fields Manager' extension.
add_filter( 'option_cfm-checkout-form', array( $this, 'translate_checkout_fields_id' ) );

// Adds support for REST requests.
add_filter( 'edd_api_v2_products_query_args', array( $this, 'rest_returns_current_language' ) );
}

/**
Expand Down Expand Up @@ -213,4 +216,16 @@ public function render_payments_table_column( $value, $payment_id, $column_name
public static function get_payment_language( $payment_id ) {
return get_post_meta( intval( $payment_id ), 'wpml_language', true );
}

/**
* @param array $args
*
* @return array
*/
public function rest_returns_current_language( $args ) {
$args['suppress_filters'] = false;

return $args;
}

}

0 comments on commit 577afce

Please sign in to comment.