在循環內外獲取文章作者的ID
在代碼開發中,會用到文章作者的ID,這次的WordPress開發分享兩個方法,可以在LOOP內外獲取到文章作者的ID。
- 原文來源:詳情
LOOP循環中
官方文檔:
get_the_author_meta( string $field = '', int|false $user_id = false )
在循環外面通過以下方法獲取用戶ID
$author_id = get_post_field ('post_author', get_the_ID() );