3

I would like to create a post and insert a url as an image, right now I have this, it works but creates a gallery block, instead I would just like to create a simple image block . What is the correct syntax to post just an image in "post_content" ?

 wp post create --post_title="test" --post_content="[gallery ids='$(wp media import https://ring.cdandlp.com/113719298.jpg --porcelain)']"

Thanks !

3

There is just [gallery] to display images BUT you can specify in which size the image(s) will be displayed. By default it's size='thumbnail'. Simply set it to size='full' to just get one full-sized image:

$ wp post create --post_title="Foobar" --post_content="[gallery ids='$(wp media import https://dummyimage.com/600x400/000/fff.jpg --porcelain)' size='full']"

More gallery shortcode options can be found on wordpress.com: https://en.support.wordpress.com/gallery/#gallery-shortcode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.