set filename as image title in the media gallery of WordPress

Question

How to set filename as image title in the media gallery of WordPress, using wp-cli ?

In other words, I’d like my image titles to be exactly their image filenames (without the extension ".jpg").

In the end, I’d like the two commands below to ouput the same value, for every image:

$ wp post get 17136 --field='guid'
https://www.example.com/wp-content/uploads/albar-vert-oihan-692X692-03-14.jpg

$ wp post get 17136 --field=title
albar-vert-oihan-692X692-03-14
0
Louis 1 month 0 Answers 10 views 0

Leave an answer