Make WordPress Core


Ignore:
Timestamp:
12/03/2021 07:37:32 PM (4 years ago)
Author:
hellofromTonya
Message:

Editor: Resolve template request ?_wp-find-template=true for new posts and pages.

The template resolution system makes a request like /?page_id=1234&_wp-find-template=true, depending on WP_Query to resolve a page or post using the page_id or p (post_id) in the query string. With new posts/pages, a placeholder post with the status auto-draft is created. But by default WP_Query will not resolve these posts, unless the query is specifically set to look for them.

This commit handles the query string to properly resolve a page or post. It adds 2 private callbacks for the processing.

Props poena, noisysocks, bernhard-reiter, costdev, hellofromTonya.
Fixes #54553.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r52272 r52316  
    681681add_action( 'wp_footer', 'the_block_template_skip_link' );
    682682add_action( 'setup_theme', 'wp_enable_block_templates' );
     683add_action( 'wp_loaded', '_add_template_loader_filters' );
    683684
    684685unset( $filter, $action );
Note: See TracChangeset for help on using the changeset viewer.