I want to fetch all post revisions for my posts.
1 Answer
From just looking at your snippet you're not actually setting $post_revisions
to any value before assigning it to your $post_data
array
-
@Ricky post revisions aren't stored in the post object like that but there's a handy function provided by WordPress to get them. You can have a look at that here wp_post_revisions()– MarcCommented May 24, 2021 at 11:12
-
Actually I wanted to make $post_revisions = wp_get_post_revisions($post_id = 31, $args = null); dynamic, so that there will be no need of changing id's again and again– RickyCommented May 24, 2021 at 11:31
-
You can use the post ID of the current post in your loop to ensure that it's getting the revisions for the right post each time– MarcCommented May 24, 2021 at 11:37