| @@ -76,8 +76,9 @@ | ||
| 76 | 76 | /** |
| 77 | 77 | * Gets the URL for the Recommendations API (GET /related). |
| 78 | 78 | * |
| 79 | 79 | * @since 2.5.0 |
| 80 | + * @since 3.24.2 Includes only the arguments that /related uses. | |
| 80 | 81 | * |
| 81 | 82 | * @see https://docs.parse.ly/content-recommendations/ |
| 82 | 83 | * |
| 83 | 84 | * @internal While this is a public method now, this should be moved to a new class. |
| @@ -91,9 +92,10 @@ | ||
| 91 | 92 | * @param int $return_limit Number of records to retrieve; defaults to "10". |
| 92 | 93 | * @return string API URL. |
| 93 | 94 | */ |
| 94 | 95 | private function get_api_url( string $site_id, ?int $published_within, ?string $sort, int $return_limit ): string { |
| 95 | - $related_api_endpoint = $this->parsely->get_content_api()->get_endpoint( '/related' ); | |
| 96 | + $content_api = $this->parsely->get_content_api(); | |
| 97 | + $related_api_endpoint = $content_api->get_endpoint( '/related' ); | |
| 96 | 98 | |
| 97 | 99 | $query_args = array( |
| 98 | 100 | 'apikey' => $site_id, |
| 99 | 101 | 'sort' => $sort, |
| @@ -103,9 +105,13 @@ | ||
| 103 | 105 | if ( null !== $published_within && 0 !== $published_within ) { |
| 104 | 106 | $query_args['pub_date_start'] = $published_within . 'd'; |
| 105 | 107 | } |
| 106 | 108 | |
| 107 | - return $related_api_endpoint->get_endpoint_url( $query_args ); | |
| 109 | + // Only the arguments that /related uses. | |
| 110 | + return add_query_arg( | |
| 111 | + $query_args, | |
| 112 | + $content_api->get_api_url() . $related_api_endpoint->get_endpoint() | |
| 113 | + ); | |
| 108 | 114 | } |
| 109 | 115 | |
| 110 | 116 | /** |
| 111 | 117 | * This is the widget function. |