Skip to content

Commit 9d5bd8c

Browse files
uk3mattwiebe
andauthored
More reliable way to get author and autorurl (#546)
--------- Co-authored-by: Matt Wiebe <[email protected]>
1 parent 74a774e commit 9d5bd8c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

includes/class-shortcodes.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ public static function author( $atts, $content, $tag ) {
390390
return '';
391391
}
392392

393-
$name = \get_the_author_meta( 'display_name', $item->post_author );
393+
$author_id = \get_post_field( 'post_author', $item->ID );
394+
$name = \get_the_author_meta( 'display_name', $author_id );
394395

395396
if ( ! $name ) {
396397
return '';
@@ -415,7 +416,8 @@ public static function authorurl( $atts, $content, $tag ) {
415416
return '';
416417
}
417418

418-
$url = \get_the_author_meta( 'user_url', $item->post_author );
419+
$author_id = \get_post_field( 'post_author', $item->ID );
420+
$url = \get_the_author_meta( 'user_url', $author_id );
419421

420422
if ( ! $url ) {
421423
return '';

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
111111
* Improved: better error messages if remote profile is not accessible
112112
* Improved: PHP 8.1 compatibility
113113
* Fixed: don't try to parse mentions or hashtags for very large (>1MB) posts to prevent timeouts
114+
* Improved: more reliable [ap_author], props @uk3
114115

115116
= 1.0.10 =
116117

0 commit comments

Comments
 (0)