Make WordPress Core

Opened 4 years ago

Closed 8 months ago

#54122 closed defect (bug) (invalid)

Action hook transition_post_status not properly working in Block Editor

Reported by: vinoth06's profile vinoth06 Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.7
Component: General Keywords: reporter-feedback close
Focuses: administration, rest-api Cc:

Description

Hi,

Scenario:
We have to get the post category/terms on post status "Pubilsh" (First time publish).

So we have used transition_post_status action hook to get the old and new status of the post. We can able to get the post category/terms when we do first publish in Classical editor. But the same is not working in Block editor.

Some Investigation (Might be wrong)

  1. On classical editor, while we publish the post, we are getting the Category on $_POST, so the wp_insert_post() will store the category before it reaches the action hook transition_post_status . So we can able to get the post terms using
    wp_get_post_terms( $post->ID, get_object_taxonomies( 'post' ) );
    
  1. But in block editor, hope we are separately storing the category and terms(Please correct me if am wrong)
  1. In block editor on old post status as "new" and new post status as "publish" (This would the first time publish of that post), in wp_insert_post() we are not getting the category or terms to store in that post, so while entering transition_post_status action hook, we are not able to get the corresponding selected category instead we are getting the Uncategory for that post as a default.
  1. In block editor we are getting the corresponding post category for action hook transition_post_status, but the post status are incorrect, the old post status and new post status is "publish", which is equivalent to update, so we are not able to identify whether the post has been published first or update.

Please let me know if the above is unclear.

Thanks
M A Vinoth Kumar

Change History (4)

This ticket was mentioned in Slack in #core-test by hellofromtonya. View the logs.


4 years ago

#2 @justinahinon
4 years ago

  • Keywords reporter-feedback added

Hello @vinoth06 ,

Thanks for opening the ticket. We have discussed this during today (September 21) test team triage meeting.

We were not quite sure if this is a bug, or might be better asked in support forum.

Could you add the steps to reproduce the issue you are experiencing?

#4 @karmatosed
8 months ago

  • Keywords close added
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Thank you for reporting this, however for now I am going to move this towards a 'invalid' as this is either something to do with the setup or a combination of not having the steps. These were asked for along with a suggestion during triage that this perhaps wasn't a bug report. As that was quite a while ago, for now let's close this. We can always reopen if more information comes up.

Note: See TracTickets for help on using tickets.