-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Custom Post type: If param 'publicly_queryable' = 'false' the editor shows "Updating failed" notice. #12677
Comments
Thanks for the report, @heldervilela. In your Developer Tools, can you take a screenshot of and share the API request / response itself? I'm curious whether the JSON is properly formed, and what sort of HTTP response you're getting from WordPress. |
@danielbachhuber I'm glad to help From what I saw when comparing with another CPT the answer is the same. |
Oh, interesting. And there's no I think the Gutenberg JavaScript shouldn't be trying to access the |
Would you be able to share the full code of your custom post type registration? I've been unable to reproduce the save failure / error notice using the following code: <?php
/**
* Plugin Name: Demo CPT
*/
add_action( 'init', function() {
register_post_type( 'book', [
'label' => 'Book',
'show_in_rest' => true,
'public' => true,
'publicly_queryable' => false,
'supports' => [ 'title', 'editor' ],
] );
} ); |
You have to add |
I can reproduce the issue with WordPress 5.0 and Gutenberg the plugin at b7e343d
Here's a GIF of my experience: And here's the final state: |
Ah, here's the earlier report of this too: https://core.trac.wordpress.org/ticket/45404 |
The error happens here, where the passed gutenberg/packages/url/src/index.js Line 170 in 1a1dc7c
This happens with the fallback case of the editor's handling of save completion, where it attempts to set a query parameter to the post gutenberg/packages/editor/src/store/reducer.js Line 1218 in 1a1dc7c
The problems are:
The reason it is assigned as an empty string can be tracked to the The value is https://github.com/WordPress/wordpress-develop/blob/5.0/src/wp-includes/link-template.php#L1235-L1243 There's a few action items here:
|
We already handle this: The preview button will not be shown if the post type is not viewable, following the same logic noted previously considering |
If the custom post type is
'publicly_queryable' => false
the editor show the notice "Updating failed" when it tries to save the draft.Because of this error:
Let me know if more info is needed.
Additional context
The text was updated successfully, but these errors were encountered: