Skip to content

Post Author Name: Add option to link to author website#75168

Open
Mustafabharmal wants to merge 2 commits intoWordPress:trunkfrom
Mustafabharmal:add/author-name-block-website-link
Open

Post Author Name: Add option to link to author website#75168
Mustafabharmal wants to merge 2 commits intoWordPress:trunkfrom
Mustafabharmal:add/author-name-block-website-link

Conversation

@Mustafabharmal
Copy link
Contributor

What?

Adds the ability to link the Post Author Name block (core/post-author-name) to the author's website URL in addition to the author archive.
Closes #75151

Why?

Currently, the Post Author Name block only allows linking to the author's post archive. This enhancement makes the block more flexible by allowing users to link to the author's website (as stored in their WordPress profile).

How?

  • Added a new linkType attribute to block.json with values archive (default) or website
  • Added a "Link destination" dropdown in the block settings that appears when the "Link to author archive" toggle is enabled
  • Updated the PHP render function to use get_the_author_meta( 'user_url', $author_id ) when linkType is set to website
  • Gracefully falls back to author archive if the website URL is empty

Testing Instructions

  1. Create or edit a post
  2. Add the Author Name block (core/post-author-name)
  3. In the block settings sidebar, enable "Link to author archive"
  4. A new "Link destination" dropdown should appear
  5. Select "Author website" from the dropdown
  6. Save and view the post on the frontend
  7. If the author has a website URL set in their profile: The author name should link to that URL
  8. If the author has no website URL: The author name should fallback to linking to the author archive

Screenshots or screencast

Before:

Screen.Recording.2026-02-03.at.3.04.45.PM.mov

After:

Screen.Recording.2026-02-03.at.3.02.19.PM.mov

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions bot added the [Package] Block library /packages/block-library label Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Mustafabharmal <mustafabharmal@git.wordpress.org>
Co-authored-by: BrookeDot <brookedot@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@BrookeDot
Copy link

This looks great!

My feedback is it appears that "website" is always an option in the dropdown, with a fallback. What may make sense from a UX experience is to check if the author has a website, and if not show the "old" toggle. Otherwise show the dropdown. I know this is slightly more code but think makes sense.

@Mustafabharmal
Copy link
Contributor Author

The Post Author Name block is often used in templates (for example in Query Loop or site templates), where the actual author is fetched dynamically on the frontend. In those scenarios, the editor does not reliably know which specific author will be rendered, and different posts in the same template may have different authors, some with a website URL and some without.

Because of this, hiding or showing the control based on the current author could lead to inconsistent behaviour or confusion, especially when the same template is used site-wide. Keeping the dropdown always available and falling back to the author archive when no website URL is set ensures predictable behaviour regardless of which author is rendered.

Still open for alternative approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Author Name Block: Link to Author URL

2 participants