Home Forums Backend Issues (wp-admin) Simple URL Field


Simple URL Field

  • Hi there! I’m creating backend interface and one of the things I’d like to display is a simple link that is associated with the post:

    I’ve done that with the link field but it’s a bit of an overkill for what the purposes are. I just want something that the user can click (but not edit) and will take them to that link in the *same* browser window.

    I thought about using jQuery to modify the link field but there has got to be an easier way to do this…would you please point me in the right direction?


  • Hi,

    I’m not sure, but you could probably use the “acf/load_field” filter.

    And a small function like :

    function read_only_field($field) {
    $field[‘readonly’] = true;
    return $field;
    add_filter(‘acf/load_field’, ‘read_only_field’);

    You could target your field using the filter :

    add_filter(‘acf/load_field/name=field_name’, ‘read_only_field’);
    add_filter(‘acf/load_field/key=field_key’, ‘read_only_field’);

  • Thanks, the readonly field does not affect the link field. I went ahead and wrote this jQuery to get rid of the buttons and make link load on the same window:

    function hideEditRemoveLinkButtons($) {
        $('.link-wrap > .-pencil').remove();
        $('.link-wrap > .-cancel').remove();
    function changeLinkTargetToSelf($) {
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Simple URL Field’ is closed to new replies.