Skip to content

Preserve target="_blank" in Biographical Info and Taxonomy Description#6866

Closed
nirajgiriXD wants to merge 9 commits intoWordPress:trunkfrom
nirajgiriXD:feat/allow-link-to-open-in-new-tab
Closed

Preserve target="_blank" in Biographical Info and Taxonomy Description#6866
nirajgiriXD wants to merge 9 commits intoWordPress:trunkfrom
nirajgiriXD:feat/allow-link-to-open-in-new-tab

Conversation

@nirajgiriXD
Copy link

@nirajgiriXD nirajgiriXD commented Jun 20, 2024

Description

This PR ensures that target="_blank" is preserved in the Biographical Info and Taxonomy Description fields to maintain the intended link behavior.

Testing Instructions

Biographical Info

  • Go to the profile page: /wp-admin/profile.php
  • In the About Yourself > Biographical Info section add a link that includes target attribute and save it, for example:
I love <a href="https://wordpress.org/" target="_blank">WordPress</a>.
  • Refresh the page and you'll see that the target attribute is preserved.
  • Go to the page where the author biography is displayed.
  • Inspect the link element, the target attribute will be present and work as expected.
add-biographical-info view-biographical-info

Taxonomy Description

  • Go to the category page: /wp-admin/edit-tags.php?taxonomy=category and select any category to edit.
  • In the Description section add a link that includes target attribute and save it, for example:
Uncategorized is the defualt category in <a href="https://wordpress.org/" target="_blank">WordPress</a>.
  • Refresh the page and you'll see that the target attribute is preserved.
  • Go to the page where the category description is displayed.
  • Inspect the link element, the target attribute will be present and work as expected.
add-term-description view-term-description

Trac ticket: https://core.trac.wordpress.org/ticket/12056

@github-actions
Copy link

github-actions bot commented Jun 20, 2024

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @nirajgiri9860@googlemail.com.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props martinkrcho, nirajgirixd, audrasjb.

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

@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@martinkrcho
Copy link

This change will affect the behaviour of all kses_* functions. I am not sure if that is desired.

@nirajgiriXD
Copy link
Author

nirajgiriXD commented Jun 24, 2024

@martinkrcho You are right; changing the $allowedtags would indeed affect the behaviour of all kses_* functions, which might not be ideal. I have revised my approach, and the new method should not cause any issues.

@nirajgiriXD nirajgiriXD marked this pull request as draft June 24, 2024 06:03
@nirajgiriXD nirajgiriXD changed the title Preserve target="_blank" in Profile Bio and Category Description Preserve target="_blank" in Biographical Info and Category Description Jun 24, 2024
@nirajgiriXD nirajgiriXD changed the title Preserve target="_blank" in Biographical Info and Category Description Preserve target="_blank" in Biographical Info and Term Description Jun 24, 2024
@nirajgiriXD nirajgiriXD marked this pull request as ready for review June 24, 2024 11:33
@nirajgiriXD nirajgiriXD changed the title Preserve target="_blank" in Biographical Info and Term Description Preserve target="_blank" in Biographical Info and Taxonomy Description Jun 25, 2024
@nirajgiriXD
Copy link
Author

@martinkrcho Could you please take a look at the PR and let me know if the new changes are satisfactory?

@martinkrcho
Copy link

@nirajgiriXD I prefer this approach to the previous one. It affects only a limited number of filters.

Would you be able to provide unit tests or provide instructions for manual testing (in the Trac ticket)?

@nirajgiriXD
Copy link
Author

@martinkrcho I've added the testing instructions along with some screenshots to the PR description.

@audrasjb
Copy link
Contributor

Closed in favor of #7792

@audrasjb
Copy link
Contributor

closed in favor of #7792

@audrasjb audrasjb closed this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants