Home Forums Backend Issues (wp-admin) Add http:// to ACF LINK Reply To: Add http:// to ACF LINK

  • Hi,

    i used $field[‘value’][‘url’] = “https”; because in my quck test it seems right.

    And the other Problem, yeah, thats what i meant with

    “if there is already a “good” url saved.”

    You have to validate inside the function if $field[‘value’][‘url’] is already a valid url.

    Should be something like these

    if($field[‘value’][‘url’] != valid url){
    //no valid url, fill the field with https/http
    $field[‘value’][‘url’] = “https”;
    //already a valid url here, nothing to do

    return $field;

    Sry, im not a php developer, but if you google for “php validate url” you should find something, thats fit.

    I think this could work here: