Add the same content to multiple pages

WordPress Development Asked on December 10, 2020

I have a website with over 500 pages. Dont ask why but none of these pages have any content in them. I have created a page layout to be added as a single wp bakery block and want to add this same block to all pages but I cant see a way of doing this without going through everypage and doing it manually. Am I missing something?

One Answer

You can do it with WP-CLI. wp post create will create a post.

wp post create ./file.txt --post_status=Publish

where file.txt contains the content you want to add (in HTML format).

To post it multiple time use a for loop.

You can use wp post update if you want to update existing post.

First step check your post ID using

wp post list 

Now update the post

wp post update <ID_1> --status=Publish --from-post=<ID_2>

Where ID_1 is the ID of the page you want to copy TO and ID_2 is the id of the page you want to duplicate from.

Answered by Dheeraj M Pai on December 10, 2020

Add your own answers!

Related Questions

Plugin updates are not shown

1  Asked on December 24, 2021


WordPress Customizer Help with FontAwesome Icon

2  Asked on December 24, 2021 by ashiquzzaman-kiron


Move users and passwords from one wordpress site to another

3  Asked on December 24, 2021 by user106747


adding fade on mouseover to images

2  Asked on December 24, 2021 by baksudin


Get post terms with hierarchical relationships

1  Asked on December 22, 2021 by mikkelbreum


All links redirecting to homepage

1  Asked on December 22, 2021 by thebeardedguy


Simple Local Avatar Plugin

1  Asked on December 19, 2021 by user34634


Disable plugins on cron and ajax page

1  Asked on December 19, 2021 by humpty


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP