close
Skip to content

Featured Image Blocks Hide all Settings if there is no query block in the same document #49560

@tomjn

Description

@tomjn

Description

This made sense when the line was written:

https://github.com/WordPress/gutenberg/blame/trunk/packages/block-library/src/post-featured-image/edit.js#L189

	/**
	 * A post featured image block placed in a query loop
	 * does not have image replacement or upload options.
	 */
	if ( ! featuredImage && isDescendentOfQueryLoop ) {
		return (
			<>
				{ controls }
				<div { ...blockProps }>
					{ placeholder() }
					<Overlay
						attributes={ attributes }
						setAttributes={ setAttributes }
						clientId={ clientId }
					/>
				</div>
			</>
		);
	}

But controls are used for more than that now! Since then featured image blocks have had new options added, particularly the "Link to post" toggle which sits inside this check in the controls component.

Step-by-step reproduction instructions

Use a featured post image block in a document that does not contain a query block.

In my situation I have a template part inside a query block + post template block, and because of this the featured image inside the template part does not have the option to enable post links, and wipes it if I add it manually and reopen

Screenshots, screen recording, code snippet

No response

Environment info

WordPress v6.2

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

Labels

[Block] Post Featured ImageAffects the Post Featured Image Block[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions