This paper deals with the optimal siting and sizing problem of photovoltaic (PV) generators in electrical distribution networks considering daily load and generation profiles. It proposes the discrete-continuous version of the vortex search algorithm (DCVSA) to locate and size the PV sources where the discrete part of the codification defines the nodes. Renewable generators are installed in these nodes, and the continuous section determines their optimal sizes. In addition, through the successive approximation power flow method, the objective function of the optimization model is obtained. This objective function is related to the minimization of the daily energy losses. This method allows determining the power losses in each period for each renewable generation input provided by the DCVSA (i.e., location and sizing of the PV sources). Numerical validations in the IEEE 33- and IEEE 69-bus systems demonstrate that: (i) the proposed DCVSA finds the optimal global solution for both test feeders when the location and size of the PV generators are explored, considering the peak load scenario. (ii) In the case of the daily operative scenario, the total reduction of energy losses for both test feeders are 23.3643% and 24.3863%, respectively; and (iii) the DCVSA presents a better numerical performance regarding the objective function value when compared with the BONMIN solver in the GAMS software, which demonstrates the effectiveness and robustness of the proposed master-slave optimization algorithm.