Virtual pin referencing physical didn't work. Can help?

They can be very confusing… or simple, depending on how you look at it and code for it.

For example this code, while using two different pin designations, will work just fine as both are referring to the same WEMOS pin. And as long as your IDE knows it is programming a Wemos D1 or D1 Mini, it will compile and work properly.

void setup() {
// BOTH are not required - only the last one takes precedence, but either of these will work as they are both referring to the same pin
  pinMode(D4, OUTPUT); // NOTE, must have the D or it will be referenced to the Arduino 4 pin (GPIO4 AKA D2) confused yet?
  pinMode(2, OUTPUT);  // NOTE also called GPIO2
}

void loop()
{
  // Turn ON and OFF the same pin - which is the built in LED on a Wemos D1/D1 Mini board
  digitalWrite(2, LOW); // 2 being the GPIO/Arduino designated pin number
  delay(500);
  digitalWrite(D4, HIGH); // D4 being the silkscreened Wemos designated pin number
  delay(500);
}

But as a rule here… always best to use the GPIO designated numbers (referenced with most ESPs as the full GIOx and just as x on the Arduino) as they generally work in the IDE for programming the differing types of boards (Arduino and ESP).