1

How can I find out what pages and post on a site contain a particular reusable block?

Typically, to find content on a site, I issue wp db search *itemlookingfor* (like the post ID, part of a file name, or a word)

OR

wp db query 'SELECT ID FROM the_posts_table WHERE post_content LIKE "%itemlookingfor%" AND post_status="publish"'

In my case, I used the reusable block's ID and no results were returned for either command. I replaced the ID of the reusable block with other common words on my site and results were returned so I think it's something special with reusable blocks.

Ideally, I'd like to use a wp-cli command or failing that, a sql command to search my database.

1 Answer 1

0

Those commands do work now after I stepped away for a few hours from the problem; so it was something on my end.

In my examples in the question, You can substitute the reusable block's post_id with the itemlookingfor to obtain the pages that contain your reusable block.

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.