Support » Fixing WordPress » [How-To] Invoke the "Insert/edit link" modal on a custom field

  • Hello,

    The insert/edit link modal and its functionality is very convenient for inserting links in the content editor. I was wondering if it was possible to leverage this modal for other purposes such as a custom field?

    I am finding many clients have custom post types that have custom fields that link to other areas of the site. The insert/edit link modal would be perfect for this, as of right now I have to instruct them to find the link they are looking for, copy and paste it into the field, which many of them find tedious or even difficult (remember we’re not all Internet savvy).

    I did some searching but wasn’t able to find anything relevant. The modal would be invoked by either focusing on the custom field itself (think the Datepicker from jQueryUI) or by clicking some button or element. In either case, as long as the user clicks the “Add Link” button the modal closes like normal and the value is inserted into the custom field (again, like the Datepicker).

    Is this possible? If not I may create a trac ticket as a feature request because I am finding this becoming more and more common as clients ask for more complicated websites.

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • If they are consistently linking only to pages within your own site, try the Advanced Custom Fields plugin to create the custom fields (metaboxes) for your Custom Posts (or any type of Posts).

    It has a field option that is a relational Page Link, so when you’re users are creating a (custom) Post, one of the custom fields could be for the Page Link, and when they click on that field they can just ‘choose’ the page to link to – no copying & pasting required, no need to know how to create hyperlinks.

    https://wordpress.org/plugins/advanced-custom-fields/

Viewing 1 replies (of 1 total)
  • The topic ‘[How-To] Invoke the "Insert/edit link" modal on a custom field’ is closed to new replies.