• Resolved cheryanne

    (@cheryanne)


    Hi there, I somehow managed to stuff up and although I restored a backup it has not helped with this particular problem. Many older pages and single post show “attempt recovery” for each paragraph. Clicking each paragraph’s recover block works perfectly but there are thousands of posts that need repairing. The link provided is for just one of these pages. Is there a CLI command that would fix this or some other method I could use? Any help would be appreciated.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Varun Sharma

    (@bestdeals)

    Hi there 👋

    Unfortunately, there isn’t a built-in WP-CLI command that directly performs the same action as clicking “Attempt recovery” on blocks site-wide. That button is triggered when Gutenberg detects invalid or corrupted block markup.

    That said, you can fix this in bulk without manually opening thousands of posts. Recommended solution (WP-CLI)

    In most cases, simply re-saving posts via WP-CLI forces WordPress to re-parse and re-serialize the blocks, which removes the recovery notice.

    ⚠️ Please take a full backup first (database + files).

    wp post list --post_type=any --post_status=publish --format=ids \ | xargs -n1 wp post update --post_status=publish

    This command:

    • Loads each post
    • Reprocesses block markup
    • Clears the “Attempt recovery” state

    It works for posts, pages, and custom post types. If some posts still show recovery

    You can force content re-serialization:

    wp post list --post_type=any --format=ids \ | xargs -n1 sh -c 'wp post update "$0" --post_content="$(wp post get "$0" --field=post_content)"' Why this happens

    This usually occurs after:

    • Database restores
    • Search/replace operations
    • Editor transitions (Classic → Block)
    • Plugin/theme changes that affect block markup

    Hope this helps, and feel free to ask if you want to limit it to specific post types or run it in smaller batches.

    Varun Sharma

    Mehraz Morshed

    (@mehrazmorshed)

    Hi @cheryanne,

    It sounds like you’re dealing with widespread block corruption after a restoration. This typically happens when WordPress can’t parse the block markup in your post content.

    You can try a block recovery plugin, “Auto Block Recovery” or “Reusable Blocks Extended”. They can scan posts for broken blocks and attempt to recover them automatically.

    Mehraz Morshed

    (@mehrazmorshed)

    Using WP-CLI, you can bulk resave posts and pages. For example:

    wp post list --post_type=post,page --format=ids | xargs wp post update

    This forces WordPress to re-parse the content and rebuild the block structure. 

    Mehraz Morshed

    (@mehrazmorshed)

    You can add --bypass if you want to skip hooks:

    wp post list --post_type=post,page --format=ids | xargs wp post update --bypass

    It will re-save every post and page in the database without triggering the usual WordPress processes. 

    But be careful, it affects every post and page and bypasses the normal safety checks!

    Thread Starter cheryanne

    (@cheryanne)

    Thank you to everyone for all your suggestions – wish me luck – backups taken.

    • This reply was modified 3 months ago by cheryanne.
Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.