fix: prevent empty author names from displaying as 'Unknown'
Enhanced lead author display logic to ensure that an empty string is not shown as the author's name. Addresses instances where an empty array element could bypass previous checks, leading to inaccurate 'Unknown' labels.
This commit is contained in:
parent
e9857658fc
commit
0a31885c8a
1 changed files with 2 additions and 2 deletions
|
@ -1138,7 +1138,7 @@ function custom_article_column($column, $post_id)
|
|||
{
|
||||
if ($column == 'lead_author') {
|
||||
$authors = get_post_meta($post_id, 'article_authors', true);
|
||||
if (!empty($authors) && is_array($authors)) {
|
||||
if (!empty($authors) && is_array($authors) && !empty($authors[0])) {
|
||||
echo esc_html($authors[0]);
|
||||
} else {
|
||||
echo __('Unknown', 'duck-behavior-journal');
|
||||
|
@ -1165,7 +1165,7 @@ function custom_letter_column($column, $post_id)
|
|||
{
|
||||
if ($column == 'lead_author') {
|
||||
$authors = get_post_meta($post_id, 'article_authors', true);
|
||||
if (!empty($authors) && is_array($authors)) {
|
||||
if (!empty($authors) && is_array($authors) && !empty($authors[0])) {
|
||||
echo esc_html($authors[0]);
|
||||
} else {
|
||||
echo __('Unknown', 'duck-behavior-journal');
|
||||
|
|
Loading…
Reference in a new issue