Skip to content

Navigation-Link does not render post_status==="private" #33215

@Chrico

Description

@Chrico

Description

With this commit 1936a04 there was some code introduced which will not render in frontend Navigation Items anymore which are set to e.G. "private" post_status.

Caused by: #27207

Step-by-step reproduction instructions

  1. Create 2 new pages "page A" and page B".
  2. Add on "page A" a new core/navigation-Block with "Page Link" which contains "page B".
    --> Everything is rendered correctly in backend and frontend.
  3. Change "page B" to post_status "private"
    --> "page A" will now show in Backend "page B" in Navigation, but in Frontend its not there anymore.

Expected behaviour

Pages which having post_status publish or private should be visible in the Navigation in frontend and backend.

Code snippet (optional)

The code should be changed to something like:

if ( is_numeric( $attributes['id'] ) ) {
	$post = get_post( $attributes['id'] );
	if (!in_array($post->post_status, ['publish', 'private'], true)) {
		return '';
	}
}

WordPress information

  • WordPress version: latest
  • Gutenberg version: 10.9.1 - looks like this was introduced with version 9.8.0
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Yes

Device information

not relevant.

Metadata

Metadata

Assignees

Labels

[Block] NavigationAffects the Navigation Block[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions