From 51604dd12215926bafa55a7e63cc190699263b44 Mon Sep 17 00:00:00 2001 From: Thomas Pike Date: Wed, 15 Jan 2025 13:14:35 +0100 Subject: [PATCH 1/3] Add support for WPML post locale --- integration/class-wpml.php | 41 ++++++++++++++++++++++++++++++++++++++ integration/load.php | 11 ++++++++++ 2 files changed, 52 insertions(+) create mode 100644 integration/class-wpml.php diff --git a/integration/class-wpml.php b/integration/class-wpml.php new file mode 100644 index 000000000..25da93312 --- /dev/null +++ b/integration/class-wpml.php @@ -0,0 +1,41 @@ + Date: Wed, 15 Jan 2025 16:00:55 +0100 Subject: [PATCH 2/3] Address review check failures --- CHANGELOG.md | 4 ++++ integration/class-wpml.php | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0741a3b45..6a9a7f9b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +* Support for WPML post locale + ### Removed * Built-in support for nodeinfo2. Use the [NodeInfo plugin](https://wordpress.org/plugins/nodeinfo/) instead. diff --git a/integration/class-wpml.php b/integration/class-wpml.php index 25da93312..81c314ce8 100644 --- a/integration/class-wpml.php +++ b/integration/class-wpml.php @@ -17,20 +17,19 @@ class WPML { * Initialize the class, registering WordPress hooks. */ public static function init() { - \add_filter( 'activitypub_post_locale', array( self::class, 'get_wpml_post_locale' ), 10, 3 ); + \add_filter( 'activitypub_post_locale', array( self::class, 'get_wpml_post_locale' ), 10, 2 ); } /** * Fetch the post locale from the WPML post data. * - * @param string $lang The language code. - * @param int $post_id The post ID. - * @param WP_Post $post The post object + * @param string $lang The language code. + * @param int $post_id The post ID. * * @return string The modified language code. */ - public static function get_wpml_post_locale( $lang, $post_id, $post ) { - $language_details = apply_filters( 'wpml_post_language_details', NULL, $post_id ); + public static function get_wpml_post_locale( $lang, $post_id ) { + $language_details = apply_filters( 'wpml_post_language_details', null, $post_id ); if ( is_array( $language_details ) && isset( $language_details['language_code'] ) ) { $lang = $language_details['language_code']; From 7e1999ceec26a0273079b4f29de1a52746d2518a Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Fri, 17 Jan 2025 11:47:19 +0100 Subject: [PATCH 3/3] added missing changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 49537699c..de59312d5 100644 --- a/readme.txt +++ b/readme.txt @@ -134,6 +134,7 @@ For reasons of data protection, it is not possible to see the followers of other = Unreleased = +* Added: Support for WPML post locale * Removed: Built-in support for nodeinfo2. Use the [NodeInfo plugin](https://wordpress.org/plugins/nodeinfo/) instead. = 4.7.1 =