I've created a custom field using ACF to display the editors of a page (this may be a comma separated list of a few) including a link to their archive, but all I'm getting is a plain text 'Array'. Could someone help me get this right? For some reason I'm not finding the right info through the documentation.

if(get_field('editor')) { echo ', edited by ' . get_field('editor') . '';}
$values = get_field('editor'); if($values) { foreach($values as $value) {
echo ' ' . $value . ','; } }
  • use print_r() instead of echo to see the contents of the array. That's purely a PHP question, hence off-topic.
    – RRikesh
    Jul 17 '13 at 13:53
  • OK, thanks for that tip, but how can I extract the information I need to produce the link? Jul 18 '13 at 8:46
  • It depends what information are being retrieved... are you retrieving an array of IDs?
    – RRikesh
    Jul 18 '13 at 9:17
  • This is what I'm getting: Array ( [0] => Array ( [ID] => 1 [user_firstname] => Name [user_lastname] => Surname [nickname] => admin [user_nicename] => admin [display_name] => Name Surname [user_email] => name.surname@mail.com [user_url] => [user_registered] => 2013-07-10 10:41:07 [user_description] => [user_avatar] => ) ) Jul 18 '13 at 10:29
  • added an answer
    – RRikesh
    Jul 18 '13 at 10:43

You can use get_author_posts_url() or get_the_author_meta():

$values = get_field( 'editor' );
if ( $values ) {
  $editors = array();
  foreach ( $values as $value ) {
    $link = get_author_posts_url( $value['ID'] ); //get the url
    $nicename = $value['user_nicename'];
    $editors[] = sprintf( '<a href="%s">%s</a>', $link, $nicename ); //create a link for each author
  echo 'Edited by: ' . implode( ',', $editors );
  • Is $values is a string of author names seperated by comma? If yes then where is $values = explode(',',$values) Jul 18 '13 at 11:15
  • According to this comment, it's an array...
    – RRikesh
    Jul 18 '13 at 11:43

You can also use Co-Authors Plus WordPress plugin.


1).Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box.

2).Co-authored posts appear on a co-author's archive page and in their feed. Co-authors may edit the posts they are associated with.

3).Co-authors who are contributors may only edit posts if they have not been published (as is core behavior).

4).Add writers as bylines without creating WordPress user accounts. Simply create a guest author profile for the writer and assign the byline as you normally would.

5).On the frontend, use the Co-Authors Plus template tags to list co-authors anywhere you'd normally list the author.


Post Authors Post Link Shortcode for this plugin

  • Thanks, but I also have a seperate field for translator. This plugin is not quite what I'm looking for. Jul 18 '13 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.