-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Editor: Enable starter pattern modal for all post types #69753
Editor: Enable starter pattern modal for all post types #69753
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @jnweaver. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
I think that just removing the post type check isn't the right approach. Because there is another starter modal for the template.
A duplicate modal will be opened if the following conditions are met:
- When the template is empty
- The active theme has a starter content that is compatible with both page and template (has
Post Types: page, wp_template
header meta data)
acf8c22ed874b367bf86f1c3081d896c.mp4
I think we need to add TEMPLATE_POST_TYPE !== getCurrentPostType()
check to determine whether the stater pattern modal should be displayed or not.
I agree with @t-hamano! We shouldn't entirely remove the check. |
@himanshupathak95, do you have time to follow up on this one so I can include the fix in the next RC? Here's a patch with the changes that @t-hamano suggested: diff --git packages/editor/src/components/start-page-options/index.js packages/editor/src/components/start-page-options/index.js
index 14d052052e7..a1661ee2fcb 100644
--- packages/editor/src/components/start-page-options/index.js
+++ packages/editor/src/components/start-page-options/index.js
@@ -17,6 +17,7 @@ import { store as interfaceStore } from '@wordpress/interface';
/**
* Internal dependencies
*/
+import { TEMPLATE_POST_TYPE } from '../../store/constants';
import { store as editorStore } from '../../store';
export function useStartPatterns() {
@@ -152,7 +153,8 @@ export default function StartPageOptions() {
return {
postId: getCurrentPostId(),
enabled:
- choosePatternModalEnabled && 'page' === getCurrentPostType(),
+ choosePatternModalEnabled &&
+ TEMPLATE_POST_TYPE !== getCurrentPostType(),
};
}, [] );
|
The E2E failure here is unexpected. Triggering the jobs again might fix the failure. |
ad7f0d3
to
2121c40
Compare
Unlinked contributors: jnweaver. Co-authored-by: himanshupathak95 <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: Mamaduka <[email protected]>
I just cherry-picked this PR to the wp/6.8 branch to get it included in the next release: 42af6b1 |
What?
Closes #69750
This PR fixes the starter pattern modal so it works for all post types, not just pages. It removes the restriction that was limiting the modal to only appear when creating new pages.
Why?
Currently, the starter pattern modal only works when creating a new page, not when creating a new post or other post types. This regression was introduced in PR #66836 and not fully resolved in PR #69081.
The condition that determines whether to show the modal explicitly checks if the current post type is 'page', preventing it from working with posts or other content types even when patterns are properly configured for those types.
How?
This PR removes the post type restriction in the enabled property of the StartPageOptions component, allowing the modal to appear for any post type when patterns are available.
Testing Instructions
Screencast
Before
Screen.Recording.2025-03-29.at.14.54.09.mov
After
Screen.Recording.2025-03-29.at.15.11.22.mov