Refactor wp cli methods