I’ve inherited a strange site, where the posts in the backend are built not in the WP editor, but in a series of ACF repeater blocks. I need to format / migrate these posts in a way that they can be parsed by the block editor. There are thousands of posts so this process really has to be programmatic.

I know the CLI lets me access the value of the content field in a post:

wp post get 123 --field=content

but this doesn’t really help me, because I need to results of a post object stitching all the ACF meta data. How can I get the CLI to output the same post content that appears on the frontend?

  • 1
    When using ACF that way the content is output using templates in the theme. The only reliable way to get that markup is to send an HTTP request to the URL, in which case you'd get the HTML for the entire page, including header and footer. Any better solution would depend entirely on the implementation by the theme, so it's not possible to provide an answer with the information given. Dec 1, 2021 at 23:44


Your Answer

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

Browse other questions tagged or ask your own question.