Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not unnecessarily pass post ID to various query loop aware functions #45828

Open
wants to merge 77 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4061516
Performance Tests: Only run 1 round of tests during PR commits
dmsnell Nov 14, 2022
da582f3
Do not unnecessarily pass post ID to various query loop aware functions.
felixarntz Nov 16, 2022
6696fdd
Remove unnecessary lookup of postId context.
felixarntz Nov 16, 2022
83a5df7
Update Changelog for 14.5.2
gutenbergplugin Nov 16, 2022
dbb9487
Tag Processor: Merge independent tests into single file
dmsnell Nov 15, 2022
fecc1d2
Post Featured Image: Only get the post title when rendering alt text …
Mamaduka Nov 17, 2022
476ce03
Sidebar: Split block tools into menu, settings, and appearance tabs (…
aaronrobertshaw Nov 17, 2022
7147465
Fix for navigation anchor links to close modal (#45829)
coreyworrell Nov 17, 2022
7ec665c
LinkControl unit tests: use user.type to type into search field (#45802)
jsnajdr Nov 17, 2022
dd166c1
Update `wp_theme_has_theme_json` to use `WP_Object_Cache` (#45543)
oandregal Nov 17, 2022
95c2b13
Navigation: adds a warning about duplicate code for the future (#45844)
scruffian Nov 17, 2022
61d0fcc
Small refactoring to the NavigableRegion component (#45849)
youknowriad Nov 17, 2022
49d0301
Performance Test: Reuse tests-branch build if possible
dmsnell Nov 12, 2022
a71adfd
List View - Stop child item selecting a parent which is already selec…
getdave Nov 17, 2022
4fd96c6
Update Changelog for 14.5.3
gutenbergplugin Nov 17, 2022
8e83fff
Perf Tests: Stop building project types during build phase
dmsnell Nov 11, 2022
b9da345
Navigation: Extract components (#45850)
scruffian Nov 18, 2022
2a2ecb3
Storybook: Add link to component folder on GitHub, retire Storysource…
mirka Nov 18, 2022
a5f2b81
Sidebar: Add list view tab for Navigation block et al. (#45483)
aaronrobertshaw Nov 18, 2022
aa0a9cf
Fix NavigableRegion README (#45879)
youknowriad Nov 18, 2022
9e6e8c9
Nav offcanvas editor: add simple back button to inspector controls (#…
getdave Nov 18, 2022
340f3a2
Fix `upgrader_process_complete` hook for `wp_theme_has_theme_json` (#…
oandregal Nov 18, 2022
12abef8
[Mobile] Update React Native Android E2E runner (#45840)
Nov 18, 2022
23c47b7
[Inserter]: Replace text in `Reusable` tab with an icon (#45851)
ntsekouras Nov 18, 2022
13c529a
Components: Fix no-node-access in Theme tests (#45896)
tyxla Nov 18, 2022
ab16f64
Components: Fix no-node-access in Text tests (#45898)
tyxla Nov 18, 2022
8e3d38a
Update Changelog for 14.5.4
gutenbergplugin Nov 18, 2022
91e758d
Bring back checks for postId context.
felixarntz Nov 18, 2022
aa422e2
Disable distraction free for small viewports (#45591)
draganescu Nov 18, 2022
225a22a
Components: Improve `Dropdown` tests (#45911)
tyxla Nov 18, 2022
b862a97
Element: Fix no-node-access in createInterpolateElement (#45894)
tyxla Nov 18, 2022
109aec4
Components: Fix no-node-access in Sandbox tests (#45908)
tyxla Nov 18, 2022
8795c6e
BlockVariationPicker: Remove unnecessary aria role (#45916)
marissa-makes Nov 19, 2022
9d936e4
Added InspectorControls import to example (#45872)
flexseth Nov 21, 2022
5046795
Perf Tests: Fix test build process to call wp-scripts
dmsnell Nov 20, 2022
35f25ab
Add submenu menu item to list view (#45794)
Nov 21, 2022
1b69ba2
Storybook: Opt in to story store v7 (#42486)
stokesman Nov 21, 2022
5c445c2
Style Engine: add first draft of contributing doc (#45930)
ramonjd Nov 21, 2022
8f57b44
Site Editor: Fix template list width (#45888)
Mamaduka Nov 21, 2022
abc8d7e
Cleanup the BlockPreview component (#45936)
youknowriad Nov 21, 2022
1906e39
Block Editor: Fix block alignment tests for React 18 (#45937)
tyxla Nov 21, 2022
bbc5489
Block Editor: Wait for popover positioning in `MediaReplaceFlow` test…
tyxla Nov 21, 2022
b55bd23
Ignore cached `wp_theme_has_theme_json` when `WP_DEBUG` is enabled (#…
mmtr Nov 21, 2022
7ef776b
Fix link & code markdown (#45708)
gvgvgvijayan Nov 21, 2022
ba9f76c
Site Logo: Apply width to logo container in editor (#45821)
mikachan Nov 21, 2022
5122e65
Components: Fix `no-node-access` in `Grid` tests (#45900)
tyxla Nov 21, 2022
37fc2a1
Enable easier drag and drop for navigation building (#45906)
draganescu Nov 21, 2022
f02087f
Components: Remove CircleIndicatorWrapper `focus-visible` outline (#4…
chad1008 Nov 21, 2022
6fa02c7
Update applying-styles-with-stylesheets.md (#45925)
hiyascout Nov 22, 2022
453866d
Add a starting page for page list block's hierarchy (#45861)
draganescu Nov 22, 2022
20cc4aa
Lodash: Simplify a few isEmpty calls (#45525)
tyxla Nov 22, 2022
a7be927
Lodash: Refactor away from `_.pick()` in block library (#45940)
tyxla Nov 22, 2022
4c21122
Style engine: trim multiple selector strings (#45873)
ramonjd Nov 22, 2022
516d05c
Clarify explanation of how 'Convert to Links' works in Page List bloc…
artemiomorales Nov 22, 2022
6cedad2
Include offcanvas specific styles (#45963)
MaggieCabrera Nov 22, 2022
821db1c
Navigation: Add label field to navigation link and navigation submenu…
scruffian Nov 22, 2022
367c180
Page List: If no parent page is set, still render all children (#45967)
scruffian Nov 22, 2022
d7e3cc1
Lodash: Refactor editor away from _.pick() (#45944)
tyxla Nov 22, 2022
c75fc6d
Update `gutenberg_get_global_stylesheet` to use `WP_Object_Cache` (#4…
mmtr Nov 22, 2022
6088f5c
Update which origins are queried for `gutenberg_get_global_settings` …
oandregal Nov 22, 2022
4183090
Cleaner logic. (#45950)
spacedmonkey Nov 22, 2022
7e76592
Tag Processor: Add ability to stop at tag closers, if requested
dmsnell Nov 15, 2022
d98e24e
Colorize template parts and Reusable blocks (#45473)
glendaviesnz Nov 23, 2022
9de3471
Bump plugin version to 14.6.0
gutenbergplugin Nov 23, 2022
4687bbd
Update Changelog for 14.6.0
gutenbergplugin Nov 23, 2022
ca1bf14
Block Editor: Fix no-node-access in RecursionProvider tests (#45902)
tyxla Nov 23, 2022
f6d8343
Post Author: Avoid errors when the user avatars are disabled (#45989)
Mamaduka Nov 23, 2022
cad25e4
Lodash: Refactor blocks away from _.pick() (#45945)
tyxla Nov 23, 2022
116a4ad
Lodash: Refactor away from `_.pick()` in block editor (#45942)
tyxla Nov 23, 2022
3a5f1f0
Alternative: add inserter to Nav block offcanvas experiment (#45947)
getdave Nov 23, 2022
8e93b93
Lodash: Refactor getMergedGlobalStyles() away from _.pick() (#45943)
tyxla Nov 23, 2022
5d4a12d
Components: Bump DateTimePicker deprecated prop removal version (#46006)
tyxla Nov 23, 2022
affc1e5
[Patterns]: Update pattern category descriptions (#46005)
ntsekouras Nov 23, 2022
1d9ea72
Rich text: create undo level before autocorrect (#45670)
ellatrix Nov 23, 2022
6a56b9b
Do not unnecessarily pass post ID to various query loop aware functions.
felixarntz Nov 16, 2022
b522579
Bring back checks for postId context.
felixarntz Nov 18, 2022
8428d26
Merge branch '37622-follow-up' of github.com:WordPress/gutenberg into…
felixarntz Nov 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions packages/block-library/src/post-featured-image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* @return string Returns the featured image for the current post.
*/
function render_block_core_post_featured_image( $attributes, $content, $block ) {
if ( ! isset( $block->context['postId'] ) ) {
return '';
}
$post_ID = $block->context['postId'];
felixarntz marked this conversation as resolved.
Show resolved Hide resolved

// Check is needed for backward compatibility with third-party plugins
// that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
if ( ! in_the_loop() && have_posts() ) {
Expand All @@ -27,7 +22,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )

$is_link = isset( $attributes['isLink'] ) && $attributes['isLink'];
$size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';
$post_title = trim( strip_tags( get_the_title( $post_ID ) ) );
$post_title = trim( strip_tags( get_the_title() ) );
$attr = get_block_core_post_featured_image_border_attributes( $attributes );
$overlay_markup = get_block_core_post_featured_image_overlay_element_markup( $attributes );

Expand All @@ -43,7 +38,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
$attr['style'] = empty( $attr['style'] ) ? $extra_styles : $attr['style'] . $extra_styles;
}

$featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
$featured_image = get_the_post_thumbnail( null, $size_slug, $attr );
if ( ! $featured_image ) {
return '';
}
Expand All @@ -52,7 +47,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
$rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
$featured_image = sprintf(
'<a href="%1$s" target="%2$s" %3$s>%4$s%5$s</a>',
get_the_permalink( $post_ID ),
get_the_permalink(),
esc_attr( $link_target ),
$rel,
$featured_image,
Expand Down
9 changes: 2 additions & 7 deletions packages/block-library/src/post-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@
* @return string Returns the filtered post title for the current post wrapped inside "h1" tags.
*/
function render_block_core_post_title( $attributes, $content, $block ) {
if ( ! isset( $block->context['postId'] ) ) {
felixarntz marked this conversation as resolved.
Show resolved Hide resolved
return '';
}

$post_ID = $block->context['postId'];
$title = get_the_title();
$title = get_the_title();

if ( ! $title ) {
return '';
Expand All @@ -35,7 +30,7 @@ function render_block_core_post_title( $attributes, $content, $block ) {

if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
$rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : '';
$title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), $rel, $title );
$title = sprintf( '<a href="%1$s" target="%2$s" %3$s>%4$s</a>', get_the_permalink(), esc_attr( $attributes['linkTarget'] ), $rel, $title );
Copy link
Member Author

Choose a reason for hiding this comment

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

I wonder why this change wasn't already present before. Is it an oversight or is there an intentional difference in behavior for why this function should still have the ID passed?

}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );

Expand Down