Skip to content

Template Editing Mode: Fix checks in 'site-editor.php'#4893

Closed
Mamaduka wants to merge 2 commits intoWordPress:trunkfrom
Mamaduka:fix/template-parts-mode-allowed-paths
Closed

Template Editing Mode: Fix checks in 'site-editor.php'#4893
Mamaduka wants to merge 2 commits intoWordPress:trunkfrom
Mamaduka:fix/template-parts-mode-allowed-paths

Conversation

@Mamaduka
Copy link
Copy Markdown
Member

@Mamaduka Mamaduka commented Jul 24, 2023

Trac ticket: https://core.trac.wordpress.org/ticket/58889


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Comment on lines +26 to +28
$is_template_part = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
$is_template_part_path = isset( $_GET['path'] ) && 'wp_template_partall' === sanitize_key( $_GET['path'] );
$is_template_part_editor = $is_template_part || $is_template_part_path;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Both checks are needed now. When editing a template part query will contain wp_template_part, and when viewing the list page, it will be /wp_template_part/all.

The slashes are removed by sanitize_key.

@tellthemachines
Copy link
Copy Markdown
Contributor

Hey @Mamaduka is this PR meant for WP 6.3?

@Mamaduka
Copy link
Copy Markdown
Member Author

@tellthemachines, I think we should land this in 6.3; otherwise, we'll have annoying regression for hybrid themes.

@audrasjb
Copy link
Copy Markdown
Contributor

Committed in https://core.trac.wordpress.org/ticket/58889

@audrasjb audrasjb closed this Jul 25, 2023
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.

3 participants