Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54536 closed defect (bug) (fixed)

Use rest_get_route_for_taxonomy_items and rest_get_route_for_post_type_items functions in full edit editting

Reported by: spacedmonkey's profile spacedmonkey Owned by: hellofromtonya's profile hellofromTonya
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.9
Component: REST API Keywords: has-patch commit
Focuses: rest-api Cc:

Description

In 51962 and 51964 new functions rest_get_route_for_post_type_items and rest_get_route_for_taxonomy_items were added. These functions are now used in all parts of core that reference taxonomy and post type rest controller endpoints. However, references to wp/v2/posts are hardcoded in full site editing screen.

Change History (14)

This ticket was mentioned in PR #1977 on WordPress/wordpress-develop by spacedmonkey.


3 years ago
#1

  • Keywords has-patch added; needs-patch removed

…y_items function in all site editing.

Trac ticket: https://core.trac.wordpress.org/ticket/54536

#2 @hellofromTonya
3 years ago

  • Keywords commit added

Marking PR 1977 for commit.

#3 @peterwilsoncc
3 years ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from new to closed

In 52276:

REST API: Fire wp_after_insert_post later in new post object endpoints.

In the new menu items, global items and template controllers manually call the function wp_after_insert_post() to manually fire the action of the same name after all potential data is updated.

This accounts for the use case in which a theme or plugin developer has modified the endpoints use of either taxonomy or meta data.

The new parameter $fire_after_hooks is added to wp_update_nav_menu_item() to control whether the wp_after_insert_post action is fired when it in turn calls wp_insert_post().

Props spacedmonkey, peterwilsoncc, zieladam.
Fixes #54536.

#4 @peterwilsoncc
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

The above commit had the wrong ticket annotation, sorry, reopening.

#5 @hellofromTonya
3 years ago

  • Owner changed from peterwilsoncc to hellofromTonya
  • Status changed from reopened to reviewing

Assigning to me for commit.

#6 @hellofromTonya
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52281:

REST API: Replace hardcoded wp/v2/ preloaded paths with rest_get_route_for_taxonomy_items() and rest_get_route_for_post_type_items() in wp-admin/site-editor.php.

[51962] and [51964] introduced two new functions: rest_get_route_for_post_type_items() and rest_get_route_for_taxonomy_items(). These functions replaced hardcoded references in all parts of core that reference taxonomy and post type rest controller endpoints. However, several instances were missed in the wp-admin/site-editor.php file.

This commit replaces those remaining hardcoded instances.

Follow-up to [51962], [51964], [52232].

Props spacedmonkey.
Fixes #54536.

#9 @walbo
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Getting a notice on the site-editor page after this was merged yesterday.

The rest_get_route_for_post_type_items excepts the post type name and not the post type object.

#10 @hellofromTonya
3 years ago

  • Keywords has-patch commit removed

Resetting keywords, which were for the previous commit.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


3 years ago

#12 @hellofromTonya
3 years ago

  • Keywords has-patch commit added

Thanks @walbo for catching that bug. You're right. It accepts a string, not object.

Marking your patch for commit.

#13 @hellofromTonya
3 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 52333:

REST API: Pass post type name to rest_get_route_for_post_type_items().

The new rest_get_route_for_post_type_items() function accepts a string, not an object. This commit passes the post type name instead of the object to resolve a notice in the site editor page.

Follow-up to [52281].

Props walbo.
Fixes #54536.

Note: See TracTickets for help on using tickets.