From ec00ace234816cc7d4b4cbad6a7674d69834f508 Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Fri, 12 May 2023 16:42:30 -0500 Subject: [PATCH] add a `activitypub_rest_url` filter --- includes/functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 39ba262..7d6f86c 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -238,8 +238,11 @@ function is_tombstone( $wp_error ) { function get_rest_url_by_path( $path = '' ) { // we'll handle the leading slash. $path = ltrim( $path, '/' ); - $url = sprintf( '/%s/%s', ACTIVITYPUB_REST_NAMESPACE, $path ); - return \get_rest_url( null, $url ); + $namespaced_path = sprintf( '/%s/%s', ACTIVITYPUB_REST_NAMESPACE, $path ); + $rest_url = \get_rest_url( null, $namespaced_path ); + // Just in case there are non-default ways of handling REST URLs. + $rest_url = \apply_filters( 'activitypub_rest_url', $rest_url, $path, ACTIVITYPUB_REST_NAMESPACE ); + return $rest_url; } /**