The nature of self-trapping transition is investigated within the framework of an extended Holstein–Hubbard model in two dimensions using a variational method. We perform a series of canonical transformations including phonon coherence effect that partly depends on the electron density and is partly independent and also the effect of on-site and nearest-neighbor phonon correlations to obtain an effective extended Hubbard model which is finally studied using the mean-field Hartree–Fock approximation. The mean-field solution of the effective extended Hubbard model suggests that the transition from the large polaron state to a small polaron state in the anti-adiabatic regime is continuous, while in the adiabatic limit it predicts a discontinuous transition.