By Finger twist


2019-05-13 05:05:23 8 Comments

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 !

1 comments

@leymannx 2019-05-13 07:23:29

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

Related Questions

Sponsored Content

0 Answered Questions

Overwrite media matching post title using WP CLI's media import command

  • 2019-01-19 16:52:55
  • Brethlosze
  • 23 View
  • 1 Score
  • 0 Answer
  • Tags:   media wp-cli

1 Answered Questions

0 Answered Questions

Attachments failing to import with WP CLI

4 Answered Questions

[SOLVED] Get media url (featured image) with wp-cli

  • 2016-10-05 10:44:24
  • Sulli
  • 890 View
  • 0 Score
  • 4 Answer
  • Tags:   wp-cli

1 Answered Questions

1 Answered Questions

[SOLVED] wp-cli post create & media import issues

1 Answered Questions

[SOLVED] Import Media To CPT with CLI & Filter Custom Taxonomy

  • 2016-07-12 21:39:38
  • thatryan
  • 130 View
  • 1 Score
  • 1 Answer
  • Tags:   wp-cli

1 Answered Questions

[SOLVED] wp-cli: run post generate and post meta add together

  • 2015-11-20 21:00:19
  • marcelo2605
  • 536 View
  • 2 Score
  • 1 Answer
  • Tags:   wp-cli

1 Answered Questions

[SOLVED] wp-cli import theme sample data

  • 2014-05-16 22:41:57
  • Wowzaaa
  • 1221 View
  • 2 Score
  • 1 Answer
  • Tags:   wp-cli

1 Answered Questions

[SOLVED] wp-cli doesn't find and wordpress installation

  • 2014-01-12 20:56:59
  • step21
  • 5326 View
  • 4 Score
  • 1 Answer
  • Tags:   wp-cli

Sponsored Content