Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Data Views: Add action for pages to set site homepage #65426
Data Views: Add action for pages to set site homepage #65426
Changes from 37 commits
c7101cf
585ef01
41474da
921d0f4
23cefbd
fb35be0
5de983c
0f3a986
1bdf2e0
937ad00
7df97a8
91a8275
44feed5
768f9cb
a04fb70
7462ce7
2d2c856
8bbd86d
6fc3490
341a068
b27305f
b387c34
2429d77
57eceb1
49be2ab
40568dc
489f4d6
c36e3ac
3cb07e9
9a5f4d7
c4bd9ae
46071d7
42e0791
3434c3f
e84a33e
baea572
c413a17
ba8becb
7687e3c
81b76f8
0ca96b0
17754bd
e722ceb
91de6c0
3c71533
6b2f6b9
6a1f468
b81eb1c
6d36c1b
8b40105
3caa096
d20b87b
29a1f72
0c5883a
24dcf8f
095bbe3
991ac5c
f2acc94
969ed4a
259a476
efbf96c
9de4488
5cbe7b4
7a2960a
4d45eaf
fb2ea4c
1a1f682
c10846b
5e5cf0c
2b37368
43dd85f
4cd6988
b2e88eb
953e999
f01d347
d96e90e
9685c3a
b029794
a9ea268
e438496
04a7ba4
c97a17d
0b8c27e
f8df3b9
a175adc
86af09a
10d97b7
c23c35b
b1707e4
d6a7059
a696688
6d01e34
18aeaf6
d486bac
8bacdbb
e1a7aa9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I see this logic as part of the editor package, so I presumed both the site editor & post editor would have the action. However, I've noticed the post editor doesn't:
It turns out to be that the
canManageOptions
check is undefined for the post editor. Would you know why is that?Checked a few things and:
canCreate
check works fine in the post editorcanManageOptions
is actually resolved when using the post editor to edit apost
(not apage
)🤔
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.
While duplicating the action for the post editor, I've managed to get the new homepage action to show so hopefully that gets around the
canManageOptions
check being undefined, butgetEntityRecord( 'postType', 'page', [pageId] )
doesn't seem to work in this editor. I'm not sure why, it's like the editor only has access to the current page that's being edited.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.
I think I've figured out a way to handle getting the current homepage in every context (page list, site editor and post editor). I'm not sure if it's the best way, but it seems to be working. I think the record was being checked too soon, so I've wrapped it in a
useEffect
in 5e5cf0c.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.
I just realized we had this in the editor that we also have in the
wordpress/fields
package (see). It sounds to me the fields package should be the central package for that kind of information about fields and posts. Not for this PR, just sharing a potential follow-up to clean things up later.