Good afternoon! I am looking for a way to insert a text box inside this insert/edit link dialog window. Due to googles recent changes for rel/nofollow links, we would like to insert an option to add a 'rel=sponsored'. However I can't find any documentation that would allow me to do this. Is there a filter or action I can add to the core WP theme files that would allow me to edit the output of a link as well as add either a textbox or option to this dialog window?

Wordpress Link Dialog box

thank you!

  • That dialog doesn't contain a nofollow checkbox, something on your site has added it. Due to the nature of that dialog adding the checkbox can't be done via PHP, it must be done via javascript
    – Tom J Nowell
    Jun 1, 2021 at 23:40
  • @TomJNowell is there any docs you could point me to as to how this box actually edits the html rendered? I don't think I'd have difficulty adding an event listener to the link button, appending elements to this section, and grabbing info from them... but then what how is this information added to the link attributes?
    – sallycakes
    Jun 2, 2021 at 18:09
  • I don't know, it's not a simple thing to do. It also won't work in the block editor and newer interfaces which use a completely different mechanism or configuring links. Even after the checkbox is inserted into the modal, additional JS is necessary to apply the attribute to the generated HTML
    – Tom J Nowell
    Jun 2, 2021 at 19:10


Your Answer

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

Browse other questions tagged or ask your own question.