ampproject / amp-wp

Enable AMP on your WordPress site, the WordPress way.
https://wordpress.org/plugins/amp/
GNU General Public License v2.0
1.79k stars 382 forks source link

Use posts member of WP_Query instead of get_posts method #7782

Closed westonruter closed 2 months ago

westonruter commented 4 months ago

Summary

Fixes #7781

This is just a simple search-and-replace. Changes are not tested.

Checklist

github-actions[bot] commented 4 months ago

Plugin builds for 3e75a3318ed05f7562155127cc7d50ecba52ec58 are ready :bellhop_bell:!

Checksums
# Development build checksums
25c05c15fd06637dbd95a474e9010293ba3522c6d551c441686dea1350bbca8f *amp.zip

# Production build checksums
e2d26d0d085af4b0f141e340330e124e21357579df36827a4c253918ace86931 *amp.zip

[!WARNING] These builds are for testing purposes only and should not be used in production.

thelovekesh commented 2 months ago

Using ( new WP_Query( $args ) )->posts is widely adopted and I have observed its usage in various projects. Some examples from repos of rtCamp, Automattic, and Google: https://github.com/search?q=org%3ArtCamp+OR+org%3AAutomattic+OR+org%3AGoogle++%22%24query-%3Eposts%22+&type=code

thelovekesh commented 2 months ago

@westonruter We are good to merge this. Can you please take a look at the test files I have changed?

thelovekesh commented 2 months ago

QA Passed ✅

Tested support data module to test if accessing the $posts property is working as expected. Posts are being fetched as expected.

(Note the URL included in Validated URLs)

image