We extend and generalize the construction of Sturm–Liouville problems for a family of Hamiltonians constrained to fulfill a third-order shape-invariance condition and focusing on the ‘−2x/3’ hierarchy of solutions to the fourth Painlevé transcendent. Such a construction has been previously addressed in the literature for some particular cases but we realize it here in the most general case. The corresponding potential in the Hamiltonian operator is a rationally extended oscillator defined in terms of the conventional Okamoto polynomials, from which we identify three different zero-modes constructed in terms of the generalized Okamoto polynomials. The third-order ladder operators of the system reveal that the complete set of eigenfunctions is decomposed as a union of three disjoint sequences of solutions, generated from a set of three-term recurrence relations. We also identify a link between the eigenfunctions of the Hamiltonian operator and a special family of exceptional Hermite polynomial.