mirror of
https://github.com/10h30/wp-strava.git
synced 2026-06-05 15:10:01 +09:00
Remove map link when doing REST request
This commit is contained in:
+2
-1
@@ -113,12 +113,13 @@ On the WP-Strava settings page you cannot currently remove and add another athle
|
||||
== Changelog ==
|
||||
|
||||
|
||||
= Unreleased =
|
||||
= 2.5.1 =
|
||||
|
||||
Fix latest_map class replacing echo with return https://wordpress.org/support/topic/latest-activity-map-shortcode-wrong-placed-on-page/
|
||||
Fix styling on pace activity max speed.
|
||||
Fix broken water pace on activity.
|
||||
Fix pace types and remove 'other' - making 'speed' default.
|
||||
Fix to remove map link in editor so you don't leave the editor.
|
||||
|
||||
= 2.5.0 =
|
||||
|
||||
|
||||
@@ -109,11 +109,22 @@ class WPStrava_Activity {
|
||||
* @since 2.3.2
|
||||
*/
|
||||
public function get_activity_link( $activity_id, $text, $title = '' ) {
|
||||
if ( WPStrava::get_instance()->settings->no_link ) {
|
||||
if ( $this->is_rest_request() || WPStrava::get_instance()->settings->no_link ) {
|
||||
return $text;
|
||||
}
|
||||
$url = esc_url( self::ACTIVITIES_URL . $activity_id );
|
||||
$title_attr = $title ? " title='" . esc_attr( $title ) . "'" : '';
|
||||
return "<a href='{$url}'{$title_attr}>{$text}</a>";
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if rest request to skip link rendering in block editor.
|
||||
*
|
||||
* @return boolean
|
||||
* @author Justin Foell <justin@foell.org>
|
||||
* @since 2.5.1
|
||||
*/
|
||||
private function is_rest_request() {
|
||||
return defined( 'REST_REQUEST' ) && REST_REQUEST;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user