This paper proposes a modified slime mold algorithm (MSMA) for finding optimal site and size of both photovoltaic generators (PGs) and shunt capacitors (SCs) in radial distribution power systems (RDPSs). The most suitable site together with the most effective size of PGs and SCs can reduce currents of conductors effectively, resulting in the significant reduction of active power loss on all conductors. MSMA and two other applied algorithms, slime mold algorithm (SMA) and equilibrium optimizer (EO), are implemented for three study cases of IEEE 33, 69, and 85 RDPSs including Case (1) place only PGs with both active and reactive power generations; Case (2) place both SCs and PGs with only active power generation; and Case (3) place both SCs and PGs with both active and reactive power generations. Comparisons with SMA and EO, MSMA can reach either the same loss or much smaller loss for study cases. Furthermore, MSMA also outperforms other previously published methods for the three study cases, and it can reach significantly smaller loss for the three cases by 1.5%, 30.55%, and 19.64% for system 1, 7.59%, 0.26%, and 0.32% for system 2, and 7.51%, 34.2%, and 22.65% for system 3. As comparing the loss among three study cases obtained by MSMA, Case 3 can reach less loss than Case 1 and Case 2 by 11.71% and 11.64% for system 1, 26.27% and 26.13% for system 2, and the same 26.6% for system 3. Thus, it is recommended that MSMA is the most effective algorithm and the placement of both SCs and PGs with active and reactive power generations is the most optimal.