Hike Nalbandyan
Hike Nalbandyan

Reputation: 1056

Wordpress: Is there any way to run cli commands from php script?

I'm want to run a wp_cli command from my php script.

for example: sudo -u www-data wp search-replace "foo" "bar" --all-tables && sudo -u www-data wp cache flush

Is there any way to do that but from inside a php script function?

Thanks.

Upvotes: 0

Views: 154

Answers (1)

Mohod Sandhya
Mohod Sandhya

Reputation: 450

For wordpress, You can try plugin "Better Search Replace" for search-replace functionality and also i have one script in php for search and replace functionality which is you can download from "https://www.dropbox.com/s/xbizw2su90ndz9j/script.php?dl=0".

Upvotes: 1

Related Questions