Skip to content

Conversation

@westonruter
Copy link
Member

@westonruter westonruter commented Apr 30, 2024

Summary

Fixes #7781

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

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@westonruter westonruter added this to the v2.5.4 milestone Apr 30, 2024
@github-actions
Copy link
Contributor

github-actions bot commented Apr 30, 2024

Plugin builds for 3e75a33 are ready 🛎️!

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 thelovekesh force-pushed the fix/query-get-posts branch from bb7e4fd to 9961198 Compare July 7, 2024 08:30
Comment on lines +3521 to +3525
if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '18.7', '>=' ) ) {
$this->assertStringContainsString( '.wp-block-audio :where(figcaption)', $amphtml_source, 'Expected block-library/style.css' );
} else {
$this->assertStringContainsString( '.wp-block-audio figcaption', $amphtml_source, 'Expected block-library/style.css' );
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +3527 to +3531
if ( version_compare( strtok( get_bloginfo( 'version' ), '-' ), '6.6', '>=' ) ) {
$this->assertStringContainsString( '[class^="wp-block-"]:not(.wp-block-gallery) > figcaption', $amphtml_source, 'Expected twentyten/blocks.css' );
} else {
$this->assertStringContainsString( '[class^="wp-block-"]:not(.wp-block-gallery) figcaption', $amphtml_source, 'Expected twentyten/blocks.css' );
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thelovekesh
Copy link
Collaborator

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
Copy link
Collaborator

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

@westonruter westonruter merged commit 3175da6 into develop Jul 8, 2024
@westonruter westonruter deleted the fix/query-get-posts branch July 8, 2024 16:50
@thelovekesh
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect use of $query->get_posts(), resulting in double request processing

3 participants