Place the 1- 1/4-by-3-by-26 inch piece of hardwood on a flat surface. Measure and make marks every 2 inches, centered along the length of the hardwood.
Install a 3/4-inch Forstner drill bit into a drill press. Set the depth gauge on the drill press so that it stops 1/4-inch above the drill press table.
Drill holes into the hardwood at each mark. The holes should measure 1-inch deep.
Sand the hardwood and each of the 3/4-by-18-inch dowels smooth with 120-grit sandpaper. Round and blunt all the corners and edges.
Apply a small amount of glue to all of the holes. Put one 3/4-by-18-inch dowel into each hole, tapping them in with a hammer if the fit is tight. Allow the glue to dry for at least an hour.
Run a stud finder along the wall in the desired location for the pants rack and locate two studs. Transfer the stud locations to the rack and mark them. Drill two 3/16-inch holes centered through the rack at the marks with a a drill/driver.
Center the rack on the wall, aligning the holes in the rack with the studs. Insert 3-inch screws into the holes. Drive the screws in tight to secure the rack to the wall. Drape pants over the dowels.