Support » Plugin: CMB2 » The “text_url” field is changing link with square brackets after saving

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    It’s not so much that CMB2 is defacing URLs, it’s more that we run the URLs through functions like esc_url() and esc_url_raw()

    Possibly customizing the escape_cb parameter for this field would help. by allowing you to create your own custom callback for this.

    https://github.com/CMB2/CMB2/wiki/Field-Parameters#escape_cb

    It’s even possible to disable escaping, though we don’t recommend it.

    moisb

    (@moisb)

    thanks for the reply Michael. But I am not a programmer. Could you be very kind and provide me exactly the code snippet I should insert into functions.php to fix this, please?
    as they are affiliate links, I suspect this change in url may be missing cookie parameters

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    despite the link and its statement about not recommending it, try passing in this for the escape callback, as part of the field args

    'escape_cb' => false

    this is the not escaping aspect, and to a degree i’m assuming it’d be just you filling in these fields, or at least trusted admins.

    Beyond that, there’s not one set way to create a custom callback that covers all your spots/possible usecases for the field.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The “text_url” field is changing link with square brackets after saving’ is closed to new replies.