Skip to content
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

Save As button not displayed with custom post_status #63161

Closed
agapetry opened this issue Jul 5, 2024 · 3 comments · Fixed by #63293
Closed

Save As button not displayed with custom post_status #63161

agapetry opened this issue Jul 5, 2024 · 3 comments · Fixed by #63293
Assignees
Labels
[Feature] Saving Related to saving functionality [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@agapetry
Copy link

agapetry commented Jul 5, 2024

Description

The Save As button (button.editor-post-save-draft) is not displayed if the post is saved with a custom non-published status. As a result, if third party code uses register_post_status() to define a custom post status, posts of that status cannot be updated without publishing.

This issue does not exist in Gutenberg 17.7 and earlier.

Step-by-step reproduction instructions

  1. In PHP, register a custom post status and insert a sample post with that status:
function sample_post_for_save_as_issue() {
  register_post_status('testing', ['label' => 'Testing', 'internal' => false, 'protected' => true]); 
  
  if (!is_user_logged_in()) {return;}
    
  $query = new WP_Query(['name' => 'status_test_345234']);
  
  if (!$query->have_posts()) {
    wp_insert_post(['post_name' => 'status_test_345234', 'post_title' => 'Status Test', 'post_status' => 'testing']);
  }
}

add_action('init', 'sample_post_for_save_as_issue');
  1. Open the sample post "Status Test" in Gutenberg.

  2. Key in some post content.

Expected behavior:

  1. Gutenberg displays the Save Draft button.

  2. Clicking the Save Draft button causes post content changes to be saved, while retaining the custom post status.

  3. The Posts screen still lists "Sample Post" and the status count caption "Testing" is still visible next to All / Mine / Published / Drafts.

Note that this is not expected to be a finished use case, just a functional Save As button which third party code can build on. It works as such with Gutenberg 17.7 and WordPress 6.5.

Screenshots, screen recording, code snippet

Sample Post saved with custom post status (indicated by status count caption though not in table row):

image

.
Save Draft button displayed in Gutenberg 17.7:

image

.
Save Draft button missing in Gutenberg 18.7:

image

Environment info

  • WordPress 6.6 rc2
  • Gutenberg 18.7.1
  • Twenty Twenty-Three theme
  • Firefox 127.0.2
  • Windows 10 on desktop

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@agapetry agapetry added the [Type] Bug An existing feature does not function as intended label Jul 5, 2024
@talldan talldan added the [Feature] Saving Related to saving functionality label Jul 5, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Jul 5, 2024

Somewhat related #3144.

@jorgefilipecosta
Copy link
Member

I confirmed the save button was available on the previous version of WordPress but now it is not available.

@agapetry
Copy link
Author

agapetry commented Jul 9, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Saving Related to saving functionality [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
5 participants