Support

Account

Home Forums General Issues Author post URL of another author

Helping

Author post URL of another author

  • Hello,

    I have an “editor” (another author) field that I created with relation user. I can get it to work with this code:

    <?php
    $array = get_field(‘editor’);
    print_r($array[‘display_name’]);
    ?>

    It shows the editor of the post. But I want it to link to the author post url of the editor, not the actual author of the post. How can I can do that?

    EDIT: I tried this but it gives me the link of the actual author:

    <a href=”
    <?php $array = get_field(‘editor’);
    echo get_author_posts_url( get_the_author_meta( ‘ID’ ) );

    ?>”>
    <?php $users = get_field(‘editor’);
    print_r($array[‘display_name’]);
    ?>

  • Ok, I solved it:

    <a href=”
    <?php $array = get_field(‘editor’);
    echo get_author_posts_url($array[‘ID’]);
    ?>”>
    <?php $users = get_field(‘editor’);
    print_r($array[‘display_name’]);
    ?>

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Author post URL of another author’ is closed to new replies.