From 9d5bd8c22090b4e9620ff000965739191c62c0b3 Mon Sep 17 00:00:00 2001 From: Ulrich Kiermayr Date: Tue, 7 Nov 2023 00:10:54 +0100 Subject: [PATCH] More reliable way to get author and autorurl (#546) --------- Co-authored-by: Matt Wiebe --- includes/class-shortcodes.php | 6 ++++-- readme.txt | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index 708aa61..491a6ad 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -390,7 +390,8 @@ class Shortcodes { return ''; } - $name = \get_the_author_meta( 'display_name', $item->post_author ); + $author_id = \get_post_field( 'post_author', $item->ID ); + $name = \get_the_author_meta( 'display_name', $author_id ); if ( ! $name ) { return ''; @@ -415,7 +416,8 @@ class Shortcodes { return ''; } - $url = \get_the_author_meta( 'user_url', $item->post_author ); + $author_id = \get_post_field( 'post_author', $item->ID ); + $url = \get_the_author_meta( 'user_url', $author_id ); if ( ! $url ) { return ''; diff --git a/readme.txt b/readme.txt index 5a70498..d59f8cd 100644 --- a/readme.txt +++ b/readme.txt @@ -111,6 +111,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu * Improved: better error messages if remote profile is not accessible * Improved: PHP 8.1 compatibility * Fixed: don't try to parse mentions or hashtags for very large (>1MB) posts to prevent timeouts +* Improved: more reliable [ap_author], props @uk3 = 1.0.10 =