Make WordPress Core

Ticket #18408: 18408.5.diff

File 18408.5.diff, 1.2 KB (added by Howdy_McGee, 12 months ago)
  • src/wp-admin/includes/admin-filters.php

     
    5050add_action( 'admin_head', 'wp_site_icon' );
    5151add_action( 'admin_head', 'wp_admin_viewport_meta' );
    5252add_action( 'customize_controls_head', 'wp_admin_viewport_meta' );
     53add_action( 'loop_start', '_preserve_global_post' );
    5354add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object' );
    5455
    5556// Prerendering.
  • src/wp-admin/includes/misc.php

     
    16411641
    16421642        return $response;
    16431643}
     1644
     1645/**
     1646 * Store the current post into the global WP_Query object.
     1647 * This will allow developers to reset to the global query
     1648 * whenever secondary queries are run.
     1649 *
     1650 * @since 6.3.0
     1651 * @access private
     1652 */
     1653function _preserve_global_post() {
     1654        global $wp_query, $post;
     1655
     1656        if( null === $wp_query->post ) {
     1657                $wp_query->post = $post;
     1658        }
     1659}